Reference
wax
¶
IHiveChainInterface
¶
Bases: IWaxBaseInterface
, Generic[ApiCollectionT]
endpoint_url
abstractmethod
property
writable
¶
endpoint_url: HttpUrl
Returns the selected endpoint url used to perform API calls.
broadcast
abstractmethod
async
¶
broadcast(
transaction: ITransaction | IOnlineTransaction,
) -> None
Broadcast transaction to the selected during Wax Chain initialization Hive Node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ITransaction | IOnlineTransaction
|
Transaction object to be broadcasted. |
required |
Raises:
Type | Description |
---|---|
TransactionNotSignedError
|
When the transaction is not signed. |
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
692 693 694 695 696 697 698 699 700 701 702 703 |
|
collect_account_authorities
abstractmethod
async
¶
collect_account_authorities(
account: AccountName,
) -> WaxAccountAuthorityInfo
Collects account authorities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
AccountName
|
Account name. |
required |
Returns:
Name | Type | Description |
---|---|---|
WaxAccountAuthorityInfo |
WaxAccountAuthorityInfo
|
Account authority info. |
Raises:
Type | Description |
---|---|
InvalidAccountNameError
|
When the account name is invalid. |
AccountNotFoundError
|
When the account is not found in the HIVE api node. |
Source code in wax/interfaces.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
|
create_transaction
abstractmethod
async
¶
create_transaction(
expiration: TTimestamp | None = None,
) -> IOnlineTransaction
Same as IWaxBaseInterface.create_transaction_with_tapos
but pulls the reference block data from the remote.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
TTimestamp | None
|
time (UTC) till transaction is valid. Default to +1 minute. |
None
|
Returns:
Type | Description |
---|---|
IOnlineTransaction
|
Transaction object |
Raises:
Type | Description |
---|---|
AssertionError
|
when expiration is not valid type. |
Source code in wax/interfaces.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
extends
abstractmethod
¶
extends(
new_api: type[ExtendedApiCollectionT],
) -> IHiveChainInterface[
ExtendedApiCollectionT | ApiCollectionT
]
Extends the current API collection with a new one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
type[ExtendedApiCollectionT]
|
New API collection class to be added. |
required |
Returns:
Name | Type | Description |
---|---|---|
IHiveChainInterface |
IHiveChainInterface[ExtendedApiCollectionT | ApiCollectionT]
|
New chain instance with the extended API collection. |
Examples:
class MyCustomApiCollection: def init(self): self.my_custom_api = MyCustomApi
chain = create_hive_chain() extended_chain = chain.extends(ExtendedApiCollection)
response = await extended_chain.api.my_custom_api.custom_endpoint() # With full intellisense support
Source code in wax/interfaces.py
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 |
|
IOnlineTransaction
¶
Bases: ITransaction
, ABC
In the future it will extend ITransaction with ability to perform a verification step (which requires API).
ITransaction
¶
Bases: ITransactionBase
push_operation
abstractmethod
¶
push_operation(operation: WaxMetaOperation) -> Self
Pushes given operation into the transaction (exactly to the list of operations).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
WaxMetaOperation
|
Operation to be pushed into the transaction in dict or proto format. |
required |
Examples:
- Proto format: transaction.push_operation(vote_pb2.vote(voter="alice", author="bob", permlink="/", weight=11))
Returns:
Name | Type | Description |
---|---|---|
Self |
Self
|
current transaction instance. |
Source code in wax/interfaces.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
IWaxBaseInterface
¶
Bases: ABC
config
abstractmethod
property
¶
config: ChainConfig
Returns protocol configuration for the current chain.
calculate_account_hp
abstractmethod
¶
calculate_account_hp(
vests: VestsNaiAssetConvertible,
total_vesting_fund_hive: HiveNaiAssetConvertible,
total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset
Calculates account HP based on given vests, total vesting fund HIVE and total vesting shares.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
VestsNaiAssetConvertible
|
VESTS asset. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset total vesting fund. |
required |
|
VestsNaiAssetConvertible
|
VESTS asset total vesting shares. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
calculated HP for the given vests, total vesting fund HIVE and total vesting shares. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
|
calculate_current_manabar_value
abstractmethod
staticmethod
¶
calculate_current_manabar_value(
head_block_time: datetime,
max_mana: int,
current_mana: int,
last_update_time: int,
) -> IManabarData
Calculates of the current manabar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
datetime
|
Head block time. Can be obtained using time property from dgpo (dynamic global properties) |
required |
|
int
|
Maximum account mana. * For upvotes should equal post_voting_power.amount from the find_account. * For downvotes remember to multiply this value by downvote_pool_percent from the dgpo. * For rc manabar calculations use max_rc value from the rc_accounts API call. |
required |
|
int
|
Current account mana. * For upvotes should equal voting_manabar.current_mana from the find_account API call. * For downvotes: downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call |
required |
|
int
|
Last update of the current account mana. * For upvotes should equal voting_manabar.last_update_time from the find_account API call. * For downvotes should equal downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call. |
required |
Returns:
Name | Type | Description |
---|---|---|
IManabarData |
IManabarData
|
Calculated manabar value. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When passed parameters are wrong. |
Source code in wax/interfaces.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
calculate_hp_apr
abstractmethod
¶
calculate_hp_apr(
head_block_num: int,
vesting_reward_percent: int,
virtual_supply: HiveNaiAssetConvertible,
total_vesting_fund_hive: HiveNaiAssetConvertible,
) -> Decimal
Calculates HP APR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
Head block number. |
required |
|
int
|
Vesting reward percent. |
required |
|
HiveNaiAssetConvertible
|
Virtual supply. |
required |
|
HiveNaiAssetConvertible
|
Total vesting fund HIVE. |
required |
Returns:
Name | Type | Description |
---|---|---|
Decimal |
Decimal
|
HP APR percent with 2 decimals |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When passed parameters are wrong. |
Source code in wax/interfaces.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
calculate_manabar_full_regeneration_time
abstractmethod
staticmethod
¶
calculate_manabar_full_regeneration_time(
head_block_time: datetime,
max_mana: int,
current_mana: int,
last_update_time: int,
) -> datetime
Calculates manabar full regeneration time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
datetime
|
Head block time. Can be obtained using time property from dgpo (dynamic global properties) |
required |
|
int
|
Maximum account mana. * For upvotes should equal post_voting_power.amount from the find_account. * For downvotes remember to multiply this value by downvote_pool_percent from the dgpo. * For rc manabar calculations use max_rc value from the rc_accounts API call. |
required |
|
int
|
Current account mana. * For upvotes should equal voting_manabar.current_mana from the find_account API call. * For downvotes: downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call |
required |
|
int
|
Last update of the current account mana. * For upvotes should equal voting_manabar.last_update_time from the find_account API call. * For downvotes should equal downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call. |
required |
Returns:
Name | Type | Description |
---|---|---|
datetime |
datetime
|
Calculated manabar full regeneration time. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
when passed parameters are wrong. |
Source code in wax/interfaces.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
|
calculate_witness_votes_hp
abstractmethod
¶
calculate_witness_votes_hp(
number: int,
total_vesting_fund_hive: HiveNaiAssetConvertible,
total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset
Calculates witness votes HP based on given votes, total vesting fund HIVE and total vesting shares.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
witness votes. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset total vesting fund. |
required |
|
VestsNaiAssetConvertible
|
VESTS asset total vesting shares. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
Calculated votes in nai asset form. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
|
create_transaction_from_json
abstractmethod
¶
create_transaction_from_json(
transaction: JsonTransaction,
) -> ITransaction
Creates transaction object from JSON transaction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
JsonTransaction
|
JSON transaction object. |
required |
Returns:
Type | Description |
---|---|
ITransaction
|
Transaction object |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
|
create_transaction_from_proto
abstractmethod
¶
create_transaction_from_proto(
transaction: ProtoTransaction,
) -> ITransaction
Creates transaction object from proto transaction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ProtoTransaction
|
Proto transaction object. |
required |
Returns:
Type | Description |
---|---|
ITransaction
|
Transaction object |
Source code in wax/interfaces.py
601 602 603 604 605 606 607 608 609 610 611 |
|
create_transaction_with_tapos
abstractmethod
¶
create_transaction_with_tapos(
tapos_block_id: str,
expiration: TTimestamp | None = None,
) -> ITransaction
Creates transaction object using basic information from chain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
Block id (mostly head) that transaction should refer to |
required |
|
TTimestamp | None
|
time (UTC) till transaction is valid. Default to +1 minute. |
None
|
Returns:
Type | Description |
---|---|
ITransaction
|
Transaction object |
Source code in wax/interfaces.py
588 589 590 591 592 593 594 595 596 597 598 599 |
|
estimate_hive_collateral
abstractmethod
¶
estimate_hive_collateral(
current_median_history_base: HbdNaiAssetConvertible,
current_median_history_quote: HiveNaiAssetConvertible,
current_min_history_base: HbdNaiAssetConvertible,
current_min_history_quote: HiveNaiAssetConvertible,
hbd_amount_to_get: HbdNaiAssetConvertible,
) -> NaiAsset
Estimate hive collateral.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
HbdNaiAssetConvertible
|
Base for Current median price retrieved by |
required |
|
HiveNaiAssetConvertible
|
Quote for Current median price retrieved by |
required |
|
HbdNaiAssetConvertible
|
Base for Current minimal price retrieved by |
required |
|
HiveNaiAssetConvertible
|
Quote for Current minimal price retrieved by |
required |
|
HbdNaiAssetConvertible
|
HBD amount to get. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
Estimated HIVE collateral. |
Raises:
Type | Description |
---|---|
CannotCreateAssetError / UnknownAssetTypeError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
get_operation_impacted_accounts
abstractmethod
staticmethod
¶
get_operation_impacted_accounts(
operation: Operation,
) -> list[AccountName]
Retrieves the list of account names (not authorities!) that are impacted by a given operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Operation
|
Operation in HF26 format or proto operation. |
required |
Returns:
Type | Description |
---|---|
list[AccountName]
|
list[AccountName]: list of account names impacted in operation. |
Raises:
Type | Description |
---|---|
(InvalidOperationFormatError, WaxValidationFailedError)
|
When operation is incorrect. |
Source code in wax/interfaces.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
get_private_key_from_password
abstractmethod
staticmethod
¶
get_private_key_from_password(
account: AccountName, role: str, password: str
) -> IPrivateKeyData
Returns private key data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
AccountName
|
Account name. |
required |
|
str
|
active | owner | posting | memo. |
required |
|
str
|
the Master Password to derive key from. |
required |
Returns:
Name | Type | Description |
---|---|---|
PrivateKeyData |
IPrivateKeyData
|
generated private key along with the associated public key in WIF format. |
Source code in wax/interfaces.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
|
get_public_key_from_signature
abstractmethod
staticmethod
¶
get_public_key_from_signature(
sig_digest: Hex, signature: Signature
) -> PublicKey
Retrieves the public key in wif format from the given sig digest and signature in hexadecimal format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Hex
|
Digest data in hexadecimal format. |
required |
|
Signature
|
Signature in hexadecimal format. |
required |
Returns:
Name | Type | Description |
---|---|---|
PublicKey |
PublicKey
|
Public key used in the signature |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When passed parameters are wrong. |
Source code in wax/interfaces.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
hbd_to_hive
abstractmethod
¶
hbd_to_hive(
hbd: HbdNaiAssetConvertible,
base: HbdNaiAssetConvertible,
quote: HiveNaiAssetConvertible,
) -> NaiAsset
Converts given HBD into HIVE, both in nai form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
HbdNaiAssetConvertible
|
HBD asset to be converted. |
required |
|
HbdNaiAssetConvertible
|
HBD asset price base. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset price quote. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
asset converted asset into HIVE. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset it is incorrect. |
Source code in wax/interfaces.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
hive_to_hbd
abstractmethod
¶
hive_to_hbd(
hive: HiveNaiAssetConvertible,
base: HbdNaiAssetConvertible,
quote: HiveNaiAssetConvertible,
) -> NaiAsset
Converts given HIVE into HBD, both in nai form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
HiveNaiAssetConvertible
|
HIVE asset to be converted. |
required |
|
HbdNaiAssetConvertible
|
HBD asset price base. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset price quote. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
converted asset into HBD. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
is_valid_account_name
abstractmethod
staticmethod
¶
is_valid_account_name(account_name: AccountName) -> bool
Checks if the given account name is valid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
AccountName
|
Account name to be checked. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the account name is valid, False otherwise. |
Source code in wax/interfaces.py
277 278 279 280 281 282 283 284 285 286 287 288 |
|
suggest_brain_key
abstractmethod
staticmethod
¶
suggest_brain_key() -> IBrainKeyData
Returns brain key data.
Returns:
Name | Type | Description |
---|---|---|
BrainKeyData |
IBrainKeyData
|
|
Source code in wax/interfaces.py
424 425 426 427 428 429 430 431 432 433 434 435 |
|
vests_to_hp
abstractmethod
¶
vests_to_hp(
vests: VestsNaiAssetConvertible,
total_vesting_fund_hive: HiveNaiAssetConvertible,
total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset
Converts given VESTS into HP, both in nai form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
VestsNaiAssetConvertible
|
VESTS asset. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset total vesting fund. |
required |
|
VestsNaiAssetConvertible
|
VESTS asset total vesting shares. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
converted asset into HP (HIVE). |
Raises:
Type | Description |
---|---|
CannotCreateAssetError / UnknownAssetTypeError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|
WaxChainOptions
¶
WaxChainOptions(
chain_id: ChainId | str = DEFAULT_CHAIN_ID,
endpoint_url: HttpUrl | str = DEFAULT_ENDPOINT_URL,
)
Bases: WaxOptions
Allows configuration of wax itself, including chain part.
Constructs WaxChainOptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ChainId | str
|
chain id used for signing. Defaults to mainnet chain id. |
DEFAULT_CHAIN_ID
|
|
HttpUrl | str
|
url of the node to connect to. Defaults to mainnet (hive.blog) node. |
DEFAULT_ENDPOINT_URL
|
Raises:
Type | Description |
---|---|
InvalidEndpointUrlFormatError
|
if endpoint_url is not valid. |
Source code in wax/wax_options.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
WaxOptions
¶
Allows configuration of wax itself.
Constructs WaxOptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ChainId
|
chain id used for signing. Defaults to mainnet chain id. |
DEFAULT_CHAIN_ID
|
Source code in wax/wax_options.py
16 17 18 19 20 21 22 23 |
|
create_hive_chain
¶
create_hive_chain(
options: WaxChainOptions | None = None,
) -> IHiveChainInterface[ApiCollectionT | WaxApiCollection]
Factory function to provide hive chain interface functionality.
Source code in wax/wax_factory.py
21 22 23 24 25 26 27 |
|
create_wax_foundation
¶
create_wax_foundation(
options: WaxOptions | None = None,
) -> IWaxBaseInterface
Factory function to provide wax base interface functionality.
Source code in wax/wax_factory.py
14 15 16 17 18 |
|
complex_operations
¶
account_update
¶
AuthorityRoleCategories
module-attribute
¶
AuthorityRoleCategories = (HiveAccountCategory,)
All of the role categories. Add new categories here.
AccountAuthorityUpdateOperation
¶
AccountAuthorityUpdateOperation(
possible_categories: PossibleCategoriesByCategoryName,
possible_roles: PossibleRoles,
*,
_private: bool = False
)
Bases: OperationBase
Account authority update operation.
Notes
To create an instance of this class, use the factory method create_for
.
Otherwise, assertion error will be raised.
Source code in wax/complex_operations/account_update.py
43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
roles
property
¶
roles: PossibleRoles
Get role to modify.
Typical usage example
account_update_operation.roles.active.any_action()
create_for
async
staticmethod
¶
create_for(
chain: IHiveChainInterface[ApiCollectionT],
account: AccountName,
) -> AccountAuthorityUpdateOperation
Factory method for creating AccountAuthorityUpdateOperation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
chain
¶ |
IHiveChainInterface
|
instance of IHiveChainInterface. |
required |
account
¶ |
AccountName
|
account name to update authority. |
required |
Returns:
Type | Description |
---|---|
AccountAuthorityUpdateOperation
|
AccountAuthorityUpdateOperation instance. |
Source code in wax/complex_operations/account_update.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
finalize
¶
finalize(
api: IWaxBaseInterface,
) -> Iterable[ConvertedToProtoOperation]
Finalize updating account authority.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api
¶ |
IWaxBaseInterface
|
Wax api subclass instance. |
required |
Returns:
Type | Description |
---|---|
Iterable[ConvertedToProtoOperation]
|
Iterable[ConvertedToProtoOperation]: List of operations. |
Raises:
Type | Description |
---|---|
NoAuthorityOperationGeneratedError
|
If no operation was generated. |
Source code in wax/complex_operations/account_update.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
PossibleCategoriesByCategoryName
dataclass
¶
PossibleCategoriesByCategoryName(hive: HiveAccountCategory)
All of possible categories grouped by name. Add new categories also here.
PossibleRoles
dataclass
¶
PossibleRoles(
active: HiveRoleAuthorityDefinition[ActiveRoleName],
owner: HiveRoleAuthorityDefinition[OwnerRoleName],
posting: HiveRoleAuthorityDefinition[PostingRoleName],
memo: HiveRoleMemoKeyDefinition,
)
role_classes
¶
hive_authority
¶
hive_account_category
¶
HiveAccountCategory
¶HiveAccountCategory()
Bases: RoleCategoryBase[HiveRoles]
Class representing the hive account category. It contains all necessary authorities for the hive account.
Attributes:
Name | Type | Description |
---|---|---|
account |
AccountName
|
Account name. |
authorities |
HiveRoles
|
Hive roles. |
hive_max_authority_membership |
int
|
Maximum authority membership. |
Notice
Trying to access the attributes before calling the init
method will raise an assertion error.
Currently available roles in the hive account category
- active
- owner
- posting
- memo
Source code in wax/complex_operations/role_classes/hive_authority/hive_account_category.py
57 58 59 60 61 |
|
init
async
¶init(
chain: IHiveChainInterface[ApiCollectionT],
account: AccountName,
) -> None
Initializes the hive account category.
Function retrieves all necessary authorities from the chain and initializes them.
Raises:
Type | Description |
---|---|
HiveTempAccountUsedError
|
When trying to edit a temporary account. |
AccountNotFoundError
|
When the account is not found on the chain. |
AssertionError
|
When the chain config is not reachable. |
Source code in wax/complex_operations/role_classes/hive_authority/hive_account_category.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
hive_role_authority_definition
¶
HiveRoleAuthorityDefinition
¶HiveRoleAuthorityDefinition(
level: TRole,
ensure_can_update: Callable[
[TRole], None
] = lambda level: None,
)
Hive role authority definition.
Attributes:
Name | Type | Description |
---|---|---|
hive_max_account_length |
int
|
Maximum account name length. |
hive_address_prefix |
str
|
Hive address prefix. |
authority |
WaxAuthority
|
Current authority. |
previous_authority |
WaxAuthority
|
Previous authority. |
Notice
All above attributes are initialized after calling the init
method.
If you try to access them before calling the init
method, an assertion will be raised.
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_authority_definition.py
35 36 37 38 39 40 41 42 43 44 45 46 |
|
is_null_authority
property
¶is_null_authority: bool
Checks if the currently selected role is null - everyone can access your account. No account, key is added.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the currently selected role is null. |
add
¶add(
account_or_key: PublicKey | AccountName,
weight: int = DEFAULT_ACCOUNT_OR_KEY_WEIGHT,
) -> Self
Adds an account or key to the currently selected role with specified weight.
Notes
If the account or key already exists, its weight is updated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account_or_key
¶ |
PublicKey | AccountName
|
Account or key to be added to the currently selected role. |
required |
weight
¶ |
int
|
Account or key weight in the authority. Default is 1. |
DEFAULT_ACCOUNT_OR_KEY_WEIGHT
|
Returns:
Name | Type | Description |
---|---|---|
Self |
Self
|
itself. |
Raises:
Type | Description |
---|---|
InvalidAccountOrKeyError
|
If the account or key is invalid. |
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_authority_definition.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
clear
¶clear() -> Self
Clears the currently selected role.
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_authority_definition.py
226 227 228 229 230 231 232 233 234 |
|
has
¶has(
account_or_key: PublicKey | AccountName,
weight: int | None = None,
) -> bool
Checks if the account or key is present in the currently selected role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account_or_key
¶ |
PublicKey | AccountName
|
Account or key to be checked. |
required |
weight
¶ |
int | None
|
Account or key weight in the authority. If provided - is checked as well. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the account or key is present in the currently selected role. |
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_authority_definition.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
|
remove
¶remove(account_or_key: PublicKey | AccountName) -> Self
Remove given account or key from the currently selected role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account_or_key
¶ |
PublicKey | AccountName
|
Account or key to be removed from the currently selected role. |
required |
Returns:
Name | Type | Description |
---|---|---|
Self |
Self
|
itself. |
Raises:
Type | Description |
---|---|
InvalidAccountOrKeyError
|
If the account or key is invalid. |
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_authority_definition.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
replace
¶replace(
account_or_key: PublicKey | AccountName,
weight: int,
new_account_or_key: PublicKey
| AccountName
| None = None,
) -> Self
Replaces an account or key in the currently selected role or changes the weight of the existing account or key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
account_or_key
¶ |
PublicKey | AccountName
|
Account or key to be replaced. |
required |
weight
¶ |
int
|
Account or key weight. |
required |
new_account_or_key
¶ |
PublicKey | AccountName | None
|
New account or key to replace the old one. If not provided, the account or key is not replaced, but weight is changed. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Self |
Self
|
itself. |
Raises:
Type | Description |
---|---|
InvalidAccountOrKeyError
|
If the account or key is invalid. |
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_authority_definition.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
set_threshold
¶Set the weight threshold for the currently selected role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
threshold
¶ |
int
|
Weight threshold for the currently selected role. |
DEFAULT_ACCOUNT_OR_KEY_WEIGHT
|
Returns:
Name | Type | Description |
---|---|---|
Self |
Self
|
itself. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the role is not initialized. |
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_authority_definition.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
hive_role_memo_key
¶
HiveRoleMemoKeyDefinition
¶HiveRoleMemoKeyDefinition()
Bases: LevelBase[MemoKeyRoleName]
Hive role memo key definition.
Attributes:
Name | Type | Description |
---|---|---|
hive_address_prefix |
str
|
Hive address prefix. |
public_key |
PublicKey
|
Current public key. |
previous_public_key |
PublicKey
|
Previous public key. |
Notice
All above attributes are initialized after calling the init
method.
If you try to access them before calling the init
method, an assertion will be raised.
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_memo_key.py
35 36 37 38 39 40 |
|
set
¶set(public_key: PublicKey) -> Self
Sets the provided public key as the account memo key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
public_key
¶ |
PublicKey
|
Public key to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
Self |
Self
|
Role instance. |
Raises:
Type | Description |
---|---|
InvalidMemoKeyError
|
If the provided public key is invalid. |
Source code in wax/complex_operations/role_classes/hive_authority/hive_role_memo_key.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
hive_roles
¶
HiveRoles
dataclass
¶HiveRoles(
active: HiveRoleAuthorityDefinition[ActiveRoleName],
owner: HiveRoleAuthorityDefinition[OwnerRoleName],
posting: HiveRoleAuthorityDefinition[PostingRoleName],
memo: HiveRoleMemoKeyDefinition,
)
Currently available roles in the hive account category.
level_base
¶
TRole
module-attribute
¶
Type variable for role names.
LevelBase
¶
LevelBase(level: TRole)
All role levels should inherit from this class.
Please remember to include role/level name in the TRole type-var
Source code in wax/complex_operations/role_classes/level_base.py
17 18 |
|
changed
abstractmethod
property
¶changed: bool
Indicates if the level has changed since the last update.
reset
abstractmethod
¶reset() -> None
Resets the level to the initial state.
Source code in wax/complex_operations/role_classes/level_base.py
35 36 37 |
|
role_category_base
¶
RoleCategoryBase
¶
Base class for all role categories. Please inherit from this class when yoy create a new category.
authorities
abstractmethod
property
¶authorities: AuthType
Returns object that is filled by the init
function.
changed
abstractmethod
property
¶changed: bool
Indicates if any of the authority levels has changed since the last update.
finalize
abstractmethod
¶finalize(
api: IWaxBaseInterface,
) -> Iterable[ConvertedToProtoOperation]
Function should return iterable object of operations that will modify the user accounts roles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api
¶ |
IWaxBaseInterface
|
Instance of the wax base api subclass. |
required |
Source code in wax/complex_operations/role_classes/role_category_base.py
44 45 46 47 48 49 50 51 |
|
init
abstractmethod
async
¶init(
chain: IHiveChainInterface[ApiCollectionT],
account: AccountName,
) -> None
Responsible for gathering authority types for the given account.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
chain
¶ |
IHiveChainInterface
|
Wax chain api instance. |
required |
account
¶ |
AccountName
|
Account name to gather authority from the given chain. |
required |
Source code in wax/complex_operations/role_classes/role_category_base.py
34 35 36 37 38 39 40 41 42 |
|
cpp_python_bridge
¶
__file__
module
¶
__file__ = "/builds/hive/wax/python/wax/cpp_python_bridge.cpython-312-x86_64-linux-gnu.so"
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__name__
module
¶
__name__ = 'wax.cpp_python_bridge'
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__package__
module
¶
__package__ = 'wax'
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__test__
module
¶
__test__ = {}
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
exceptions
¶
AccountNotFoundError
¶
AccountNotFoundError(account: AccountName)
Bases: WaxError
Raised when an account is not found when calling find_accounts
API call.
Source code in wax/exceptions/chain_errors.py
14 15 16 17 |
|
AssetError
¶
Bases: WaxError
Base error for the asset-related exceptions.
For more detailed exceptions, see the subclasses.
AuthorityCannotBeSatisfiedError
¶
AuthorityCannotBeSatisfiedError(authority_level: str)
Bases: HiveAccountCategoryError
Raised when the authority cannot be satisfied.
Source code in wax/exceptions/chain_errors.py
45 46 47 48 |
|
DecimalConversionNegativePrecisionError
¶
DecimalConversionNegativePrecisionError(precision: int)
Bases: DecimalConversionError
Raised when decimal conversion fails because the precision is negative.
Source code in wax/exceptions/conversion_errors.py
17 18 19 20 |
|
DecimalConversionNotANumberError
¶
Bases: DecimalConversionError
Raised when decimal conversion fails because the value is not a number.
HiveMaxAuthorityMembershipExceededError
¶
Bases: HiveAccountCategoryError
Raised when the authority membership exceeds the maximum.
Source code in wax/exceptions/chain_errors.py
35 36 37 38 39 |
|
HiveTempAccountUsedError
¶
HiveTempAccountUsedError()
Bases: HiveAccountCategoryError
Raised when trying to edit a temporary account in the hive category.
Source code in wax/exceptions/chain_errors.py
27 28 29 |
|
InvalidAccountNameError
¶
InvalidAccountNameError(account: AccountName)
Bases: WaxError
Raised when an account name is invalid.
Note that this error is different from AccountNotFoundError
and is created to not make an API call
when the account name is invalid.
Source code in wax/exceptions/validation_errors.py
29 30 31 32 |
|
InvalidAccountOrKeyError
¶
InvalidAccountOrKeyError(account_or_key: str)
Bases: WaxError
Raised when account or key is invalid.
Source code in wax/exceptions/validation_errors.py
51 52 53 54 |
|
InvalidMemoKeyError
¶
InvalidMemoKeyError(memo_key: PublicKey)
Bases: WaxError
Raised when an invalid memo key is provided.
Source code in wax/exceptions/validation_errors.py
60 61 62 63 |
|
WaxImportProtoBeforeCompileError
¶
WaxImportProtoBeforeCompileError()
Bases: WaxError
Raised when trying to import a proto module before compiling it.
Source code in wax/exceptions/wax_error.py
11 12 13 14 |
|
WaxValidationFailedError
¶
WaxValidationFailedError(reason: str)
Bases: WaxError
Raises when validation using wax failed.
Source code in wax/exceptions/validation_errors.py
15 16 17 18 |
|
asset_errors
¶
chain_errors
¶
AccountNotFoundError
¶
AccountNotFoundError(account: AccountName)
Bases: WaxError
Raised when an account is not found when calling find_accounts
API call.
Source code in wax/exceptions/chain_errors.py
14 15 16 17 |
|
AuthorityCannotBeSatisfiedError
¶
AuthorityCannotBeSatisfiedError(authority_level: str)
Bases: HiveAccountCategoryError
Raised when the authority cannot be satisfied.
Source code in wax/exceptions/chain_errors.py
45 46 47 48 |
|
HiveMaxAuthorityMembershipExceededError
¶
Bases: HiveAccountCategoryError
Raised when the authority membership exceeds the maximum.
Source code in wax/exceptions/chain_errors.py
35 36 37 38 39 |
|
HiveTempAccountUsedError
¶
HiveTempAccountUsedError()
Bases: HiveAccountCategoryError
Raised when trying to edit a temporary account in the hive category.
Source code in wax/exceptions/chain_errors.py
27 28 29 |
|
conversion_errors
¶
DecimalConversionNegativePrecisionError
¶
DecimalConversionNegativePrecisionError(precision: int)
Bases: DecimalConversionError
Raised when decimal conversion fails because the precision is negative.
Source code in wax/exceptions/conversion_errors.py
17 18 19 20 |
|
DecimalConversionNotANumberError
¶
Bases: DecimalConversionError
Raised when decimal conversion fails because the value is not a number.
validation_errors
¶
InvalidAccountNameError
¶
InvalidAccountNameError(account: AccountName)
Bases: WaxError
Raised when an account name is invalid.
Note that this error is different from AccountNotFoundError
and is created to not make an API call
when the account name is invalid.
Source code in wax/exceptions/validation_errors.py
29 30 31 32 |
|
InvalidAccountOrKeyError
¶
InvalidAccountOrKeyError(account_or_key: str)
Bases: WaxError
Raised when account or key is invalid.
Source code in wax/exceptions/validation_errors.py
51 52 53 54 |
|
InvalidEndpointUrlFormatError
¶
InvalidEndpointUrlFormatError(url: HttpUrl | str)
Bases: WaxError
Raised when endpoint url is in invalid format.
Source code in wax/exceptions/validation_errors.py
42 43 44 45 |
|
InvalidMemoKeyError
¶
InvalidMemoKeyError(memo_key: PublicKey)
Bases: WaxError
Raised when an invalid memo key is provided.
Source code in wax/exceptions/validation_errors.py
60 61 62 63 |
|
NoAuthorityOperationGeneratedError
¶
NoAuthorityOperationGeneratedError()
Bases: WaxError
Raised when no operations are generated.
Source code in wax/exceptions/validation_errors.py
69 70 71 |
|
WaxValidationFailedError
¶
WaxValidationFailedError(reason: str)
Bases: WaxError
Raises when validation using wax failed.
Source code in wax/exceptions/validation_errors.py
15 16 17 18 |
|
wax_error
¶
WaxImportProtoBeforeCompileError
¶
WaxImportProtoBeforeCompileError()
Bases: WaxError
Raised when trying to import a proto module before compiling it.
Source code in wax/exceptions/wax_error.py
11 12 13 14 |
|
helpy
¶
OffsetTimeControl
dataclass
¶
OffsetTimeControl(
speed_up_rate: float | int | None = None,
offset: str = "+0",
)
Bases: TimeControl
Represents a control mechanism for time-related parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The offset value specifying a relative time. Format: '[+-]N[mhdy\s]', where 'N' is any positive floating-point number. The letter at the end denotes the unit of time (y: year d: day, h: hour, m: minute). Default without any letter means second. (e.g. "+10h") |
'+0'
|
|
float
|
An speed-up rate Format: positive floating-point number. (e.g. "10.0") |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
|
Methods:
Name | Description |
---|---|
as_string |
Returns a string representation of the time control parameters. |
SpeedUpRateTimeControl
dataclass
¶
SpeedUpRateTimeControl(
speed_up_rate: float | int | None = None,
)
Bases: TimeControl
Represents a control mechanism for time-related parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
float | int | None
|
An speed-up rate Format: positive floating-point number. (e.g. "10.0") |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
if |
Methods:
Name | Description |
---|---|
as_string |
Returns a string representation of the time control parameters. |
StartTimeControl
dataclass
¶
StartTimeControl(
speed_up_rate: float | int | None = None,
start_time: Literal["head_block_time"]
| datetime = now(),
)
Bases: TimeControl
Represents a control mechanism for time-related parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Literal['head_block_time'] | datetime
|
The starting time specifying an absolute time. Format: "@%Y-%m-%d %H:%M:%S" or "@%Y-%m-%d %H:%M:%S.%f" (e.g. "@1970-01-01 00:00:00") |
now()
|
|
float | int | None
|
An speed-up rate Format: positive floating-point number. (e.g. "10.0") |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
if |
Methods:
Name | Description |
---|---|
as_string |
Returns a string representation of the time control parameters. |
Time
¶
async_wait_for
async
classmethod
¶
async_wait_for(
predicate: Callable[[], bool]
| Callable[[], Awaitable[bool]],
*,
timeout: float | timedelta = inf,
timeout_error_message: str | None = None,
poll_time: float = 1.0
) -> float
Waits asynchronously for the predicate to return True.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Callable[[], bool] | Callable[[], Awaitable[bool]]
|
Callable that returns boolean value. |
required |
|
float | timedelta
|
Timeout in seconds or preferably timedelta. |
inf
|
|
str | None
|
Message that will be displayed if timeout is reached. |
None
|
|
float
|
Time between predicate calls. |
1.0
|
Raises:
Type | Description |
---|---|
TimeoutError
|
if given timeout exceeds |
Returns:
Type | Description |
---|---|
float
|
Time it took to wait for predicate return True. |
Source code in wax/helpy/_interfaces/time.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
|
from_now
classmethod
¶
from_now(
*,
milliseconds: int = 0,
seconds: int = 0,
minutes: int = 0,
hours: int = 0,
days: int = 0,
weeks: int = 0,
months: int = 0,
years: int = 0,
time_zone: timezone | None = utc,
serialize: bool = True,
serialize_format: TimeFormats | str = DEFAULT_FORMAT
) -> str | datetime
Adds to current time given time periods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
milliseconds to add. |
0
|
|
int
|
seconds to add. |
0
|
|
int
|
minutes to add. |
0
|
|
int
|
hours to add. |
0
|
|
int
|
days to add. |
0
|
|
int
|
weeks to add. |
0
|
|
int
|
months to add. |
0
|
|
int
|
years to add. |
0
|
|
timezone | None
|
time zone to set. |
utc
|
|
bool
|
return serialized time or as datetime. |
True
|
|
TimeFormats | str
|
if serialize, this determines format. |
DEFAULT_FORMAT
|
Raises:
Type | Description |
---|---|
ValueError
|
no periods has been given |
Returns:
Type | Description |
---|---|
str | datetime
|
serialized or as datetime, shifted time with given time periods. |
Source code in wax/helpy/_interfaces/time.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
|
parse
classmethod
¶
parse(
time: str,
*,
format_: TimeFormats | str | None = None,
time_zone: timezone | None = utc
) -> datetime
Parses given string with given format in given timezone.
Note
By default, when format_
parameter is specified as None - the ISO format (Time.DEFAULT_FORMAT)
and ISO format including milliseconds (Time.DEFAULT_FORMAT_WITH_MILLIS) could be parsed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
time string to parse |
required |
|
TimeFormats | str | None
|
format of given time string |
None
|
|
timezone | None
|
timezone to set after parsing |
utc
|
Raises:
Type | Description |
---|---|
ParseError
|
if parsing is not possible |
Returns:
Type | Description |
---|---|
datetime
|
datetime.datetime object |
Source code in wax/helpy/_interfaces/time.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
sync_wait_for
classmethod
¶
sync_wait_for(
predicate: Callable[[], bool],
*,
timeout: float | timedelta = inf,
timeout_error_message: str | None = None,
poll_time: float = 1.0
) -> float
Waits synchronously for the predicate to return True.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Callable[[], bool]
|
Callable that returns boolean value. |
required |
|
float | timedelta
|
Timeout in seconds or preferably timedelta. |
inf
|
|
str | None
|
Message that will be displayed if timeout is reached. |
None
|
|
float
|
Time between predicate calls. |
1.0
|
Raises:
Type | Description |
---|---|
TimeoutError
|
if given timeout exceeds |
Returns:
Type | Description |
---|---|
float
|
Time it took to wait for predicate return True. |
Source code in wax/helpy/_interfaces/time.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
|
wait_for
staticmethod
¶
wait_for(
predicate: Callable[[], bool],
*,
timeout: float | timedelta = inf,
timeout_error_message: str | None = None,
poll_time: float = 1.0
) -> float
Waits for the predicate to return True in the given timeout and raises TimeoutError if it was exceeded.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Callable[[], bool]
|
Callable that returns boolean value. |
required |
|
float | timedelta
|
Timeout in seconds or preferably timedelta (e.g. tt.Time.minutes(1)). |
inf
|
|
str | None
|
Message that will be displayed if timeout is reached. |
None
|
|
float
|
Time between predicate calls. |
1.0
|
Returns:
Type | Description |
---|---|
float
|
Time in seconds that was spent on waiting. |
Source code in wax/helpy/_interfaces/time.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
exceptions
¶
BlockWaitTimeoutError
¶
BlockWaitTimeoutError(
last_block_number: int,
block_number: int,
last_irreversible_block_number: int,
)
Bases: HelpyError
Raised if reached not expected block number.
Creates exception.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
last fetched block number |
required |
|
int
|
block that was expected to be irreversible |
required |
|
int
|
last fetched irreversible block number |
required |
Source code in wax/helpy/exceptions.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
ParseError
¶
Bases: HelpyError
Raised if cannot parse given str, e.x. url, date, asset.
interfaces
¶
ApiCollectionT
module-attribute
¶
ApiCollectionT = TypeVar('ApiCollectionT')
TypeVar for API collection, available by default in the IHiveChainInterface.
ChainConfig
module-attribute
¶
ChainConfig is a type alias for a dictionary containing chain configuration parameters.
ExtendedApiCollectionT
module-attribute
¶
ExtendedApiCollectionT = TypeVar('ExtendedApiCollectionT')
TypeVar for API collection that will be added to the IHiveChainInterface by the user.
JsonTransaction
module-attribute
¶
Type alias for a transaction in JSON format, which is used in Hive API calls.
ProtoTransaction
module-attribute
¶
ProtoTransaction: TypeAlias = transaction
Type alias for a transaction in proto format.
TTimestamp
module-attribute
¶
TTimestamp is a type alias for a timestamp that can be either a datetime object or a timedelta object.
IHiveChainInterface
¶
Bases: IWaxBaseInterface
, Generic[ApiCollectionT]
endpoint_url
abstractmethod
property
writable
¶
endpoint_url: HttpUrl
Returns the selected endpoint url used to perform API calls.
broadcast
abstractmethod
async
¶
broadcast(
transaction: ITransaction | IOnlineTransaction,
) -> None
Broadcast transaction to the selected during Wax Chain initialization Hive Node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ITransaction | IOnlineTransaction
|
Transaction object to be broadcasted. |
required |
Raises:
Type | Description |
---|---|
TransactionNotSignedError
|
When the transaction is not signed. |
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
692 693 694 695 696 697 698 699 700 701 702 703 |
|
collect_account_authorities
abstractmethod
async
¶
collect_account_authorities(
account: AccountName,
) -> WaxAccountAuthorityInfo
Collects account authorities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
AccountName
|
Account name. |
required |
Returns:
Name | Type | Description |
---|---|---|
WaxAccountAuthorityInfo |
WaxAccountAuthorityInfo
|
Account authority info. |
Raises:
Type | Description |
---|---|
InvalidAccountNameError
|
When the account name is invalid. |
AccountNotFoundError
|
When the account is not found in the HIVE api node. |
Source code in wax/interfaces.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
|
create_transaction
abstractmethod
async
¶
create_transaction(
expiration: TTimestamp | None = None,
) -> IOnlineTransaction
Same as IWaxBaseInterface.create_transaction_with_tapos
but pulls the reference block data from the remote.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
TTimestamp | None
|
time (UTC) till transaction is valid. Default to +1 minute. |
None
|
Returns:
Type | Description |
---|---|
IOnlineTransaction
|
Transaction object |
Raises:
Type | Description |
---|---|
AssertionError
|
when expiration is not valid type. |
Source code in wax/interfaces.py
677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
extends
abstractmethod
¶
extends(
new_api: type[ExtendedApiCollectionT],
) -> IHiveChainInterface[
ExtendedApiCollectionT | ApiCollectionT
]
Extends the current API collection with a new one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
type[ExtendedApiCollectionT]
|
New API collection class to be added. |
required |
Returns:
Name | Type | Description |
---|---|---|
IHiveChainInterface |
IHiveChainInterface[ExtendedApiCollectionT | ApiCollectionT]
|
New chain instance with the extended API collection. |
Examples:
class MyCustomApiCollection: def init(self): self.my_custom_api = MyCustomApi
chain = create_hive_chain() extended_chain = chain.extends(ExtendedApiCollection)
response = await extended_chain.api.my_custom_api.custom_endpoint() # With full intellisense support
Source code in wax/interfaces.py
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 |
|
IManabarData
dataclass
¶
IOnlineTransaction
¶
Bases: ITransaction
, ABC
In the future it will extend ITransaction with ability to perform a verification step (which requires API).
ITransaction
¶
Bases: ITransactionBase
push_operation
abstractmethod
¶
push_operation(operation: WaxMetaOperation) -> Self
Pushes given operation into the transaction (exactly to the list of operations).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
WaxMetaOperation
|
Operation to be pushed into the transaction in dict or proto format. |
required |
Examples:
- Proto format: transaction.push_operation(vote_pb2.vote(voter="alice", author="bob", permlink="/", weight=11))
Returns:
Name | Type | Description |
---|---|---|
Self |
Self
|
current transaction instance. |
Source code in wax/interfaces.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
ITransactionBase
¶
Bases: ABC
id
abstractmethod
property
¶
id: TransactionId
Returns id of the transaction (HF26 serialization used).
Returns:
Name | Type | Description |
---|---|---|
TransactionId |
TransactionId
|
Transaction id in hex form. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
impacted_accounts
abstractmethod
property
¶
impacted_accounts: list[AccountName]
Returns list of account names (not authorities!) impacted by a whole transaction.
Returns:
Type | Description |
---|---|
list[AccountName]
|
list[AccountName]: List of account names impacted by the transaction. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When any of the accounts is incorrect. |
is_signed
abstractmethod
property
¶
is_signed: bool
Checks if underlying transaction has been already signed at least one time.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Either true or false based on the signatures amount. |
required_authorities
abstractmethod
property
¶
required_authorities: ITransactionRequiredAuthorities
Returns required authority accounts from the transaction.
Returns:
Name | Type | Description |
---|---|---|
ITransactionRequiredAuthorities |
ITransactionRequiredAuthorities
|
All possible authority models. |
sig_digest
abstractmethod
property
¶
sig_digest: SigDigest
Returns digest of the transaction for signing (HF26 serialization used).
Returns:
Name | Type | Description |
---|---|---|
SigDigest |
SigDigest
|
Digest of the transaction in hex form. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction or chain id is incorrect. |
signature_keys
abstractmethod
property
¶
transaction
abstractmethod
property
¶
transaction: ProtoTransaction
Fills up constructed transaction basing on preconfigured TAPOS. Also applies the transaction expiration time.
Returns:
Name | Type | Description |
---|---|---|
ProtoTransaction |
ProtoTransaction
|
Proto transaction object. |
add_signature
abstractmethod
¶
Adds your signature to the internal signatures list inside underlying transaction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Signature
|
Signature to be added. |
required |
Returns:
Name | Type | Description |
---|---|---|
Signature |
Signature
|
Added transaction signature. |
Source code in wax/interfaces.py
157 158 159 160 161 162 163 164 165 166 167 |
|
sign
abstractmethod
async
¶
sign(
wallet: AsyncUnlockedWallet, public_key: PublicKey
) -> Signature
Signs asynchronously the transaction using given public key. Applies the transaction expiration time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
AsyncUnlockedWallet
|
Unlocked wallet to be used for signing. |
required |
|
PublicKey
|
Public key for signing (remember that should be available in the wallet!) |
required |
Returns:
Name | Type | Description |
---|---|---|
Signature |
Signature
|
Transaction signature signed using given key. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
to_api
abstractmethod
¶
to_api() -> str
Converts the created transaction into the Hive API-form str.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Transaction in Hive API-form. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
190 191 192 193 194 195 196 197 198 199 200 |
|
to_api_json
abstractmethod
¶
to_api_json() -> JsonTransaction
Converts the created transaction into the Hive API-form JSON.
Returns:
Name | Type | Description |
---|---|---|
JsonTransaction |
JsonTransaction
|
Transaction in Hive API-form. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
214 215 216 217 218 219 220 221 222 223 224 |
|
to_binary_form
abstractmethod
¶
to_binary_form() -> Hex
Allows to serialize underlying transaction to HF26 specific binary form, then return it as hexstring.
Returns:
Name | Type | Description |
---|---|---|
Hex |
Hex
|
Serialized transaction in hex form. |
Source code in wax/interfaces.py
181 182 183 184 185 186 187 188 |
|
to_dict
abstractmethod
¶
Converts the created transaction into the Hive API-form dict.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict[str, Any]
|
Transaction in Hive API-form. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
202 203 204 205 206 207 208 209 210 211 212 |
|
to_string
abstractmethod
¶
to_string() -> str
Converts transaction object into the protobuf JSON string.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Protobuf JSON string. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
169 170 171 172 173 174 175 176 177 178 179 |
|
validate
abstractmethod
¶
validate() -> None
Validates current transaction.
Returns:
Type | Description |
---|---|
None
|
None |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
129 130 131 132 133 134 135 136 137 138 139 |
|
IWaxBaseInterface
¶
Bases: ABC
config
abstractmethod
property
¶
config: ChainConfig
Returns protocol configuration for the current chain.
calculate_account_hp
abstractmethod
¶
calculate_account_hp(
vests: VestsNaiAssetConvertible,
total_vesting_fund_hive: HiveNaiAssetConvertible,
total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset
Calculates account HP based on given vests, total vesting fund HIVE and total vesting shares.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
VestsNaiAssetConvertible
|
VESTS asset. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset total vesting fund. |
required |
|
VestsNaiAssetConvertible
|
VESTS asset total vesting shares. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
calculated HP for the given vests, total vesting fund HIVE and total vesting shares. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
|
calculate_current_manabar_value
abstractmethod
staticmethod
¶
calculate_current_manabar_value(
head_block_time: datetime,
max_mana: int,
current_mana: int,
last_update_time: int,
) -> IManabarData
Calculates of the current manabar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
datetime
|
Head block time. Can be obtained using time property from dgpo (dynamic global properties) |
required |
|
int
|
Maximum account mana. * For upvotes should equal post_voting_power.amount from the find_account. * For downvotes remember to multiply this value by downvote_pool_percent from the dgpo. * For rc manabar calculations use max_rc value from the rc_accounts API call. |
required |
|
int
|
Current account mana. * For upvotes should equal voting_manabar.current_mana from the find_account API call. * For downvotes: downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call |
required |
|
int
|
Last update of the current account mana. * For upvotes should equal voting_manabar.last_update_time from the find_account API call. * For downvotes should equal downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call. |
required |
Returns:
Name | Type | Description |
---|---|---|
IManabarData |
IManabarData
|
Calculated manabar value. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When passed parameters are wrong. |
Source code in wax/interfaces.py
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
calculate_hp_apr
abstractmethod
¶
calculate_hp_apr(
head_block_num: int,
vesting_reward_percent: int,
virtual_supply: HiveNaiAssetConvertible,
total_vesting_fund_hive: HiveNaiAssetConvertible,
) -> Decimal
Calculates HP APR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
Head block number. |
required |
|
int
|
Vesting reward percent. |
required |
|
HiveNaiAssetConvertible
|
Virtual supply. |
required |
|
HiveNaiAssetConvertible
|
Total vesting fund HIVE. |
required |
Returns:
Name | Type | Description |
---|---|---|
Decimal |
Decimal
|
HP APR percent with 2 decimals |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When passed parameters are wrong. |
Source code in wax/interfaces.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
calculate_manabar_full_regeneration_time
abstractmethod
staticmethod
¶
calculate_manabar_full_regeneration_time(
head_block_time: datetime,
max_mana: int,
current_mana: int,
last_update_time: int,
) -> datetime
Calculates manabar full regeneration time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
datetime
|
Head block time. Can be obtained using time property from dgpo (dynamic global properties) |
required |
|
int
|
Maximum account mana. * For upvotes should equal post_voting_power.amount from the find_account. * For downvotes remember to multiply this value by downvote_pool_percent from the dgpo. * For rc manabar calculations use max_rc value from the rc_accounts API call. |
required |
|
int
|
Current account mana. * For upvotes should equal voting_manabar.current_mana from the find_account API call. * For downvotes: downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call |
required |
|
int
|
Last update of the current account mana. * For upvotes should equal voting_manabar.last_update_time from the find_account API call. * For downvotes should equal downvote_manabar.current_mana. * For rc manabar calculations use rc_manabar value from the rc_accounts API call. |
required |
Returns:
Name | Type | Description |
---|---|---|
datetime |
datetime
|
Calculated manabar full regeneration time. |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
when passed parameters are wrong. |
Source code in wax/interfaces.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
|
calculate_witness_votes_hp
abstractmethod
¶
calculate_witness_votes_hp(
number: int,
total_vesting_fund_hive: HiveNaiAssetConvertible,
total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset
Calculates witness votes HP based on given votes, total vesting fund HIVE and total vesting shares.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
int
|
witness votes. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset total vesting fund. |
required |
|
VestsNaiAssetConvertible
|
VESTS asset total vesting shares. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
Calculated votes in nai asset form. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
|
create_transaction_from_json
abstractmethod
¶
create_transaction_from_json(
transaction: JsonTransaction,
) -> ITransaction
Creates transaction object from JSON transaction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
JsonTransaction
|
JSON transaction object. |
required |
Returns:
Type | Description |
---|---|
ITransaction
|
Transaction object |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When the transaction is incorrect. |
Source code in wax/interfaces.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
|
create_transaction_from_proto
abstractmethod
¶
create_transaction_from_proto(
transaction: ProtoTransaction,
) -> ITransaction
Creates transaction object from proto transaction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ProtoTransaction
|
Proto transaction object. |
required |
Returns:
Type | Description |
---|---|
ITransaction
|
Transaction object |
Source code in wax/interfaces.py
601 602 603 604 605 606 607 608 609 610 611 |
|
create_transaction_with_tapos
abstractmethod
¶
create_transaction_with_tapos(
tapos_block_id: str,
expiration: TTimestamp | None = None,
) -> ITransaction
Creates transaction object using basic information from chain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
Block id (mostly head) that transaction should refer to |
required |
|
TTimestamp | None
|
time (UTC) till transaction is valid. Default to +1 minute. |
None
|
Returns:
Type | Description |
---|---|
ITransaction
|
Transaction object |
Source code in wax/interfaces.py
588 589 590 591 592 593 594 595 596 597 598 599 |
|
estimate_hive_collateral
abstractmethod
¶
estimate_hive_collateral(
current_median_history_base: HbdNaiAssetConvertible,
current_median_history_quote: HiveNaiAssetConvertible,
current_min_history_base: HbdNaiAssetConvertible,
current_min_history_quote: HiveNaiAssetConvertible,
hbd_amount_to_get: HbdNaiAssetConvertible,
) -> NaiAsset
Estimate hive collateral.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
HbdNaiAssetConvertible
|
Base for Current median price retrieved by |
required |
|
HiveNaiAssetConvertible
|
Quote for Current median price retrieved by |
required |
|
HbdNaiAssetConvertible
|
Base for Current minimal price retrieved by |
required |
|
HiveNaiAssetConvertible
|
Quote for Current minimal price retrieved by |
required |
|
HbdNaiAssetConvertible
|
HBD amount to get. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
Estimated HIVE collateral. |
Raises:
Type | Description |
---|---|
CannotCreateAssetError / UnknownAssetTypeError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
get_operation_impacted_accounts
abstractmethod
staticmethod
¶
get_operation_impacted_accounts(
operation: Operation,
) -> list[AccountName]
Retrieves the list of account names (not authorities!) that are impacted by a given operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Operation
|
Operation in HF26 format or proto operation. |
required |
Returns:
Type | Description |
---|---|
list[AccountName]
|
list[AccountName]: list of account names impacted in operation. |
Raises:
Type | Description |
---|---|
(InvalidOperationFormatError, WaxValidationFailedError)
|
When operation is incorrect. |
Source code in wax/interfaces.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
|
get_private_key_from_password
abstractmethod
staticmethod
¶
get_private_key_from_password(
account: AccountName, role: str, password: str
) -> IPrivateKeyData
Returns private key data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
AccountName
|
Account name. |
required |
|
str
|
active | owner | posting | memo. |
required |
|
str
|
the Master Password to derive key from. |
required |
Returns:
Name | Type | Description |
---|---|---|
PrivateKeyData |
IPrivateKeyData
|
generated private key along with the associated public key in WIF format. |
Source code in wax/interfaces.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
|
get_public_key_from_signature
abstractmethod
staticmethod
¶
get_public_key_from_signature(
sig_digest: Hex, signature: Signature
) -> PublicKey
Retrieves the public key in wif format from the given sig digest and signature in hexadecimal format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Hex
|
Digest data in hexadecimal format. |
required |
|
Signature
|
Signature in hexadecimal format. |
required |
Returns:
Name | Type | Description |
---|---|---|
PublicKey |
PublicKey
|
Public key used in the signature |
Raises:
Type | Description |
---|---|
WaxValidationFailedError
|
When passed parameters are wrong. |
Source code in wax/interfaces.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
|
hbd_to_hive
abstractmethod
¶
hbd_to_hive(
hbd: HbdNaiAssetConvertible,
base: HbdNaiAssetConvertible,
quote: HiveNaiAssetConvertible,
) -> NaiAsset
Converts given HBD into HIVE, both in nai form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
HbdNaiAssetConvertible
|
HBD asset to be converted. |
required |
|
HbdNaiAssetConvertible
|
HBD asset price base. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset price quote. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
asset converted asset into HIVE. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset it is incorrect. |
Source code in wax/interfaces.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
hive_to_hbd
abstractmethod
¶
hive_to_hbd(
hive: HiveNaiAssetConvertible,
base: HbdNaiAssetConvertible,
quote: HiveNaiAssetConvertible,
) -> NaiAsset
Converts given HIVE into HBD, both in nai form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
HiveNaiAssetConvertible
|
HIVE asset to be converted. |
required |
|
HbdNaiAssetConvertible
|
HBD asset price base. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset price quote. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
converted asset into HBD. |
Raises:
Type | Description |
---|---|
UnknownAssetTypeError / CannotCreateAssetError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
is_valid_account_name
abstractmethod
staticmethod
¶
is_valid_account_name(account_name: AccountName) -> bool
Checks if the given account name is valid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
AccountName
|
Account name to be checked. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the account name is valid, False otherwise. |
Source code in wax/interfaces.py
277 278 279 280 281 282 283 284 285 286 287 288 |
|
suggest_brain_key
abstractmethod
staticmethod
¶
suggest_brain_key() -> IBrainKeyData
Returns brain key data.
Returns:
Name | Type | Description |
---|---|---|
BrainKeyData |
IBrainKeyData
|
|
Source code in wax/interfaces.py
424 425 426 427 428 429 430 431 432 433 434 435 |
|
vests_to_hp
abstractmethod
¶
vests_to_hp(
vests: VestsNaiAssetConvertible,
total_vesting_fund_hive: HiveNaiAssetConvertible,
total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset
Converts given VESTS into HP, both in nai form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
VestsNaiAssetConvertible
|
VESTS asset. |
required |
|
HiveNaiAssetConvertible
|
HIVE asset total vesting fund. |
required |
|
VestsNaiAssetConvertible
|
VESTS asset total vesting shares. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
converted asset into HP (HIVE). |
Raises:
Type | Description |
---|---|
CannotCreateAssetError / UnknownAssetTypeError / AssertionError
|
When passed asset is incorrect. |
Source code in wax/interfaces.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|
models
¶
asset
¶
AnyNaiAssetConvertible
module-attribute
¶
AnyNaiAssetConvertible = (
HiveNaiAssetConvertible
| HbdNaiAssetConvertible
| VestsNaiAssetConvertible
)
Type alias for types convertible to any of the HIVE, HBD, or VESTS nai formats.
AssetAmount
module-attribute
¶
Type alias for an number that can be used as an amount of an asset.
HbdNaiAssetConvertible
module-attribute
¶
Type alias for types convertible to Hbd nai format.
HiveNaiAssetConvertible
module-attribute
¶
Type alias for types convertible to Hive nai format.
NaiAsset
module-attribute
¶
NaiAsset: TypeAlias = asset
Type alias for an asset in nai format (hf26).
VestsNaiAssetConvertible
module-attribute
¶
Type alias for types convertible to Vests nai format.
AssetFactory
¶
Bases: Protocol
coins
staticmethod
¶
coins(amount: AssetAmount) -> NaiAsset
Returns asset in nai/HF26 format with given amount.
Please notice that this function works with precision!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
¶ |
AssetAmount
|
amount of the asset. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
asset in nai form. |
Raises:
Type | Description |
---|---|
DecimalConversionNotANumberError
|
Raised when given amount is in invalid format. |
Source code in wax/models/asset.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
satoshis
staticmethod
¶
Returns asset in nai/HF26 format with given amount.
Please notice that this function works without precision and accept only integers!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount
¶ |
int
|
amount of the asset. |
required |
Returns:
Name | Type | Description |
---|---|---|
NaiAsset |
NaiAsset
|
asset in nai form. |
Raises:
Type | Description |
---|---|
TypeError
|
If given amount is not integer. |
Source code in wax/models/asset.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
authority
¶
AccountAuths
module-attribute
¶
AccountAuths: TypeAlias = dict[AccountName, int]
AccountAuths is a type alias for a dictionary mapping account names to their weight in the authority structure.
KeyAuths
module-attribute
¶
KeyAuths is a type alias for a dictionary mapping public keys to their weight in the authority structure.
WaxAuthority
module-attribute
¶
WaxAuthority: TypeAlias = authority
Type alias for one of the authorities used in wax.
ITransactionRequiredAuthorities
¶
Bases: ABC
Interface for transaction required authorities.
active_accounts
abstractmethod
property
¶
active_accounts: set[AccountName]
Get required active accounts.
other_authorities
abstractmethod
property
¶
other_authorities: list[WaxAuthority]
Get required other authorities.
owner_accounts
abstractmethod
property
¶
owner_accounts: set[AccountName]
Get required owner accounts.
posting_accounts
abstractmethod
property
¶
posting_accounts: set[AccountName]
Get required posting accounts.
WaxAccountAuthorityInfo
dataclass
¶
WaxAccountAuthorityInfo(
account: AccountName,
authorities: WaxAuthorities,
memo_key: PublicKey,
)
Represents the authority information for an account.
WaxAuthorities
dataclass
¶
WaxAuthorities(
owner: WaxAuthority | None = None,
active: WaxAuthority | None = None,
posting: WaxAuthority | None = None,
)
Represents the authorities available when using wax.
basic
¶
AccountName
module-attribute
¶
AccountName is a type alias for the name of an account on the Hive blockchain.
ChainId
module-attribute
¶
ChainId is a type alias for the chain identifier of the Hive blockchain.
HeadBlockId
module-attribute
¶
HeadBlockId is a type alias for the identifier of the head block.
PublicKey
module-attribute
¶
PublicKey is a type alias for a public key in the Hive blockchain.
SigDigest
module-attribute
¶
SigDigest is a type alias for the signature digest of a transaction.
Signature
module-attribute
¶
Signature is a type alias for a hexadecimal string representing a signature.
TransactionId
module-attribute
¶
TransactionId is a type alias for the identifier of a transaction.
ChainReferenceData
dataclass
¶
ChainReferenceData(
time: HiveDateTime, head_block_id: HeadBlockId = ""
)
Data that is used to reference the chain.
key_data
¶
IBrainKeyData
¶
Bases: IPrivateKeyData
, ABC
Interface for brain key data.
operations
¶
Operation
module-attribute
¶
Operation: TypeAlias = ProtoOperation | ProtocolOperation
Either a proto or a protocol(hf26) operation.
ProtoOperation
module-attribute
¶
ProtoOperation is a type alias for a type that can be converted to a proto message.
ProtocolOperation
module-attribute
¶
ProtocolOperation is a type alias for the operation in the protocol (hf26) format.
proto
¶
operations
¶
account_create
¶
account_create(
*,
fee: asset | None = ...,
creator: str | None = ...,
new_account_name: str | None = ...,
owner: authority | None = ...,
active: authority | None = ...,
posting: authority | None = ...,
memo_key: str | None = ...,
json_metadata: str | None = ...
)
Bases: Message
A new account may be created only by an existing account. The account that creates a new account pays a fee. The fee amount is set by the witnesses.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/09_account_create.md?ref_type=heads&plain=0&blame=1#2-parameters
creator
instance-attribute
¶
creator: str
@param {string} creator - An account that creates a new account.
fee
property
¶
fee: asset
@param {asset} fee - Paid by creator. The witnesses decide the amount of the fee. Now, it is 3 HIVE.
memo_key
instance-attribute
¶
memo_key: str
@param {string} memo_key - Not authority, public memo key.
new_account_name
instance-attribute
¶
new_account_name: str
@param {string} new_account_name - Valid account name may consist of many parts separated by a dot, total may have up to 16 characters, parts have to start from a letter, may be followed by numbers, or '-'.
account_create_with_delegation
¶
account_create_with_delegation(
*,
fee: asset | None = ...,
delegation: asset | None = ...,
creator: str | None = ...,
new_account_name: str | None = ...,
owner: authority | None = ...,
active: authority | None = ...,
posting: authority | None = ...,
memo_key: str | None = ...,
json_metadata: str | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
Deprecated.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/41_account_create_with_delegation.md?ref_type=heads
account_update
¶
account_update(
*,
account: str | None = ...,
owner: authority | None = ...,
active: authority | None = ...,
posting: authority | None = ...,
memo_key: str | None = ...,
json_metadata: str | None = ...
)
Bases: Message
Operations account_update_operation and account_update2_operation share a limit of allowed updates of the owner authority: two executions per 60 minutes (HIVE_OWNER_UPDATE_LIMIT) (meaning each of them can be executed twice or both can be executed once during that time period). After 30 days (HIVE_OWNER_AUTH_RECOVERY_PERIOD) using the account recovery process to change the owner authority is no longer possible. The operation account_update_operation allows changing authorities, it doesn’t allow changing the posting_json_metadata.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/10_account_update.md?ref_type=heads
account
instance-attribute
¶
account: str
@param {string} account - Account name, it cannot be updated.
active
property
¶
active: authority
@param {authority} active - In order to update the {active}, the active authority is required. If a user provides a new authority, the old one will be deleted.
json_metadata
instance-attribute
¶
json_metadata: str
@param {string} json_metadata - json_string; in order to update the {json_metadata}, the active authority is required.
memo_key
instance-attribute
¶
memo_key: str
@param {string} memo_key - In order to update the {memo_key}, active authority is required. If a user provides a new key, the old one will be deleted.
owner
property
¶
owner: authority
@param {authority} owner - In order to update the {owner}, the owner authority is required. It may be changed 2 times per hour. If a user provides a new authority, the old one will be deleted, but the deleted authority may be used up to 30 days in the process of the recovery account.
posting
property
¶
posting: authority
@param {authority} posting - In order to update the {posting}, the active authority is required. If a user provides a new authority, the old one will be deleted.
account_update2
¶
account_update2(
*,
account: str | None = ...,
owner: authority | None = ...,
active: authority | None = ...,
posting: authority | None = ...,
memo_key: str | None = ...,
json_metadata: str | None = ...,
posting_json_metadata: str | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
There are two operations that allow updating an account data: account_update_operation and account_update2_operation. Operations account_update_operation and account_update2_operation share a limit of allowed updates of the owner authority - two executions per 60 minutes (HIVE_OWNER_UPDATE_LIMIT) - meaning each of them can be executed twice or both can be executed once during that time period. After 30 days (HIVE_OWNER_AUTH_RECOVERY_PERIOD) using the account recovery process to change the owner authority is no longer possible. The operation allows to update authority, json_metadata and the posting_json_metadata. Depending on what the user wants to change, a different authority has to be used. Each authority (owner, active, posting, memo_key) consists of: - weight_threshold - key or account name with its weight The authority may have more than one key and more than one assigned account name.
@example Example 1: The posting authority: weight_threshold = 1 'first_key', weight = 1 'second_key', weight = 1 'account_name_1', weight = 1 The above settings mean that a user with 'first_key', a user with 'second_key' or a user 'account_name_1' may post on behalf of this account.
@example Example 2: The posting authority: weight_threshold = 2 'first_key', weight = 1 'second_key', weight = 1 'account_name_1', weight = 1 The above settings mean that at least two signatures are needed to post on behalf of this account.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/43_account_update2.md?ref_type=heads
account
instance-attribute
¶
account: str
@param {string} account - Account name, it cannot be updated.
active
property
¶
active: authority
@param {authority} active - Optional. In order to update the {active}, the active authority is required. If a user provides a new authority, the old one will be deleted.
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions
json_metadata
instance-attribute
¶
json_metadata: str
@param {string} json_metadata - json_string; In order to update the {json_metadata}, the active authority is required.
memo_key
instance-attribute
¶
memo_key: str
@param {string} memo_key - Optional. In order to update the {memo_key}, the active authority is required. If a user provides a new key, the old one will be deleted.
owner
property
¶
owner: authority
@param {authority} owner - Optional. In order to update the {owner}, the owner authority is required. It may be changed 2 times per hour. If a user provides a new authority, the old one will be deleted.
posting
property
¶
posting: authority
@param {authority} posting - Optional. In order to update the {posting}, the active authority is required. If a user provides a new authority, the old one will be deleted.
posting_json_metadata
instance-attribute
¶
posting_json_metadata: str
@param {string} posting_json_metadata - json_string; In order to update the { posting_json_metadata }, the posting authority is required.
account_witness_proxy
¶
account_witness_proxy(
*, account: str | None = ..., proxy: str | None = ...
)
Bases: Message
A user may vote for a witness or proposal directly (using an operation: account_witness_vote_operation or update_proposal_votes_operation) or indirectly (using the proxy - operation: account_witness_proxy_operation). If a user sets a proxy, the witness votes are removed and the proposal votes are deactivated. If a user removes a proxy, there are no witness votes and the proposal votes are activated. Settings proxy means that a user wants to cede a decision on which witnesses to vote for to an account indicated as {proxy}. {proxy} will also vote for proposals in the name of {account}. If the operation account_witness_vote_operation or account_witness_proxy_operation or update_proposal_votes_operation is not executed in HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD, the votes are removed and the virtual operation: expired_account_notification_operation is generated. If the proxy was set and now it is removed, the additionally the virtual operation: proxy_cleared_operation is generated.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/13_account_witness_proxy.md?ref_type=heads
account_witness_vote
¶
account_witness_vote(
*,
account: str | None = ...,
witness: str | None = ...,
approve: bool | None = ...
)
Bases: Message
A user may vote for a witness directly using an operation: account_witness_vote_operation or indirectly using the proxy - operation: account_witness_proxy_operation. All accounts with a Hive Power (also called Vesting Fund Shares or VESTS) can vote for up to 30 witnesses, but you cannot vote twice for the same witnesses. If a proxy is specified then all existing votes are removed. Your vote power depends on your HP. If the operation account_witness_vote_operation or account_witness_proxy_operation or update_proposal_votes_operation is not executed in a HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD, the votes are removed and the virtual operation: expired_account_notification_operation is generated.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/12_account_witness_vote.md?ref_type=heads
approve
instance-attribute
¶
approve: bool
@param {bool} approve - To vote for the witness, the approve = true. To remove the vote, the approve = false.
cancel_transfer_from_savings
¶
cancel_transfer_from_savings(
*,
from_account: str | None = ...,
request_id: int | None = ...
)
Bases: Message
Funds withdrawals from the savings can be canceled at any time before it is executed.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/34_cancel_transfer_from_savings.md?ref_type=heads
change_recovery_account
¶
change_recovery_account(
*,
account_to_recover: str | None = ...,
new_recovery_account: str | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
The operation change_recovery_account_operation allows a user to update their recovery account. It is important to keep it actual, because only a recovery account may create a request account recovery in case of compromised the owner authority. By default the recovery account is set to the account creator or it is empty if it was created by temp account or mined. In order to cancel the change_recovery_account_operation, the operation change_recovery_account_operation, the operation should be created with {new_recovery_account} set to the old one. The operation is done with a 30 days (HIVE_OWNER_AUTH_RECOVERY_PERIOD) delay.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/26_change_recovery_account.md?ref_type=heads
claim_account
¶
claim_account(
*,
creator: str | None = ...,
fee: asset | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
A user may create a new account using a pair of operations: claim_account_operation and create_claimed_account_operation. After the operation claim_account_operation a user receives a token: pending claimed accounts and later (using operation create_claimed_account_operation) a user may create a new account. After executing the operation claim_account_operation, a new account is not created.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/22_claim_account.md?ref_type=heads
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions - Not currently used.
fee
property
¶
fee: asset
@param {asset} fee - The amount of fee for creating a new account is decided by the witnesses. It may be paid in HIVE or in the Recourse Credit (RC). If a user wants to pay a fee in RC, it should be set {fee= 0}.
claim_reward_balance
¶
claim_reward_balance(
*,
account: str | None = ...,
reward_hive: asset | None = ...,
reward_hbd: asset | None = ...,
reward_vests: asset | None = ...
)
Bases: Message
An operation claim_reward_balance_operation is used to transfer previously collected author and/or curation rewards from sub balance for the reward to regular balances. Rewards expressed in Hive and HBD are transferred to liquid balances, rewards in HP increase vesting balance. When claimed, HP rewards are immediately active towards governance voting power (compare with transfer_to_vesting_operation).
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/39_claim_reward_balance.md?ref_type=heads
reward_hbd
property
¶
reward_hbd: asset
@param {asset} reward_hbd - The amount of HBD reward to be transferred to liquid balance
reward_hive
property
¶
reward_hive: asset
@param {asset} reward_hive - The amount of Hive reward to be transferred to liquid balance.
reward_vests
property
¶
reward_vests: asset
@param {asset} reward_vests - The amount of HP reward to be transferred to vesting balance.
collateralized_convert
¶
collateralized_convert(
*,
owner: str | None = ...,
requestid: int | None = ...,
amount: asset | None = ...
)
Bases: Message
Similar to convert_operation, this operation instructs the blockchain to convert HIVE to HBD. The operation is performed after 3.5 days, but the owner gets HBD immediately. The price risk is cushioned by extra HIVE (HIVE_COLLATERAL_RATIO = 200 % ). After actual conversion takes place the excess HIVE is returned to the owner.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/48_collateralized_convert.md?ref_type=heads
collateralized_convert_immediate_conversion
¶
collateralized_convert_immediate_conversion(
*,
owner: str | None = ...,
requestid: int | None = ...,
hbd_out: asset | None = ...
)
Bases: Message
Related to collateralized_convert_operation. Generated every time above operation is executed. Contains amount of HBD received right when the transfer actually happens. @see fill_collateralized_convert_request
comment
¶
comment(
*,
parent_author: str | None = ...,
parent_permlink: str | None = ...,
author: str | None = ...,
permlink: str | None = ...,
title: str | None = ...,
body: str | None = ...,
json_metadata: str | None = ...
)
Bases: Message
Using comment operation a user may create a post or a comment. From the blockchain point of view, it is the same operation – always comment. If a comment has no parent, it is a post. The parent of the comment may be a post or a comment. Users may comment their own comments.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/01_comment.md?ref_type=heads
author
instance-attribute
¶
author: str
@param {string} author - Account name, the author of the post or the comment. It cannot be modified.
body
instance-attribute
¶
body: str
@param {string} body - The content of the post or the comment. It may be modified.
json_metadata
instance-attribute
¶
json_metadata: str
@param {string} json_metadata - There is no blockchain validation on json_metadata, but the structure has been established by the community. From the blockchain point of view it is a json file. For the second layer, the following keys may be used: - app, e.g. peakd/2023.2.3 - format, e.g. markdown - tags, e.g. photography - users - images
parent_author
instance-attribute
¶
parent_author: str
@param {string} parent_author - Account name, the author of the commented post or comment. If the operation creates a post, it is empty. It cannot be modified.
parent_permlink
instance-attribute
¶
parent_permlink: str
@param {string} parent_permlink - The identifier of the commented post or comment. When a user creates a post, it may contain the identifier of the community (e.g. hive-174695) or main tag (e.g. travel). It cannot be modified.
permlink
instance-attribute
¶
permlink: str
@param {string} permlink - Unique to the author, the identifier of the post or comment. It cannot be modified.
title
instance-attribute
¶
title: str
@param {string} title - The title of the submitted post, in case of the comment, is often empty. It may be modified.
comment_options
¶
comment_options(
*,
author: str | None = ...,
permlink: str | None = ...,
max_accepted_payout: asset | None = ...,
percent_hbd: int | None = ...,
allow_votes: bool | None = ...,
allow_curation_rewards: bool | None = ...,
extensions: Iterable[global___comment_options_extension]
| None = ...
)
Bases: Message
The operation comment_options_operation allows to set properties regarding payouts, rewards or beneficiaries (using {extensions}) for comments. If the operation: comment_options_operation is done by one of the frontends, it is usually in the same transaction with the operation: comment_operation. If a comment has received any votes, only the parameter {percent_hbd} may be changed.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/19_comment_options.md?ref_type=heads
allow_curation_rewards
instance-attribute
¶
allow_curation_rewards: bool
@param {bool} allow_curation_rewards - The flag that allows to decide whether the voters for the comment should receive the curation rewards. Rewards return to the reward fund. Default value: allow_curation_rewards = true.
allow_votes
instance-attribute
¶
allow_votes: bool
@param {bool} allow_votes - The flag that allows to decide whether the comment may receive a vote. Default value: allow_votes = true.
author
instance-attribute
¶
author: str
@param {string} author - Account name, the author of the comment.
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
global___comment_options_extension
]
@param {comment_options_extension} extensions - It may contain the list of the beneficiaries, the accounts that should receive the author reward. The list consists of the account name and the weight of the shares in the author reward. If the sum of the weights is less than 100%, the rest of the reward is received by the author. It should be defined less than 128 accounts. The allowed range of the weight is from 0 to 10000 (0 – 100%). The beneficiaries should be listed in alphabetical order, no duplicates.
max_accepted_payout
property
¶
max_accepted_payout: asset
@param {asset} max_accepted_payout - The maximum value of payout in HBD. Default value: max_accepted_payout = asset( 1000000000, HBD_SYMBOL ). The allowed value should be less than the default value. If max_accepted_payout = 0, then voters and authors will not receive the payout.
percent_hbd
instance-attribute
¶
percent_hbd: int
@param {number} percent_hbd - By default the author reward is paid 50% HP and 50 % HBD. In some rare situations, instead of HBD, the Hive may be paid. percent_hbd = HIVE_100_PERCENT means that 100 % of HBD part is paid in HBD. A user may decide how many percent of HBD (from 50 %) they wants to receive in the HBD, the rest will be paid out in HP. Default value: percent_hbd = HIVE_100_PERCENT. The allowed value should be less than the default value. This is the only parameter that can be modified after the comment receives any vote.
convert
¶
convert(
*,
owner: str | None = ...,
requestid: int | None = ...,
amount: asset | None = ...
)
Bases: Message
This operation instructs the blockchain to start a conversion of HBD to Hive.
The funds are deposited after 3.5 days.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/08_convert.md?ref_type=heads
create_claimed_account
¶
create_claimed_account(
*,
creator: str | None = ...,
new_account_name: str | None = ...,
owner: authority | None = ...,
active: authority | None = ...,
posting: authority | None = ...,
memo_key: str | None = ...,
json_metadata: str | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
The operation create_claimed_account_operation may be used by the user who has the token. Pending claimed accounts (see claim_account_operation). After executing the operation create_claimed_account_operation, a new account is created.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/23_create_claimed_account.md?ref_type=heads
creator
instance-attribute
¶
creator: str
@param {string} creator - An account who create a new account.
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions - Not currently used.
new_account_name
instance-attribute
¶
new_account_name: str
@param {string} new_account_name - Account name. Valid account name may consist of many parts separated by a dot, total may have up to 16 characters, parts have to start from a letter, may be followed by numbers, or “-“.
create_proposal
¶
create_proposal(
*,
creator: str | None = ...,
receiver: str | None = ...,
start_date: str | None = ...,
end_date: str | None = ...,
daily_pay: asset | None = ...,
subject: str | None = ...,
permlink: str | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
There is a Decentralized Hive Fund (DHF) on the Hive. Users may submit proposals for funding and if the proposal receives enough votes, it will be funded. In order to create a proposal user should create a post first and then marked it as a proposal with the operation create_proposal_operation. User defines when the proposal starts and ends and how many funds need to realize it. The creating proposal costs 10 HBD and additionally 1 HBD for each day over 60 days. The fee goes back to DHF. Every hour all active proposals are processed and taking into consideration a current number of votes payments are done. Accounts can create/remove votes anytime.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/44_create_proposal.md?ref_type=heads
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions
custom
¶
custom(
*,
required_auths: Iterable[str] | None = ...,
id: int | None = ...,
data: str | None = ...
)
Bases: Message
There are the following custom operations: custom_operation, custom_json_operation and custom_binary (currently is disabled). The operation: custom_operation provides a generic way to add higher level protocols on top of witness consensus operations.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/15_custom.md?ref_type=heads
custom_json
¶
custom_json(
*,
required_auths: Iterable[str] | None = ...,
required_posting_auths: Iterable[str] | None = ...,
id: str | None = ...,
json: str | None = ...
)
Bases: Message
The operation custom_json_operation works similar as custom_operation, but it is designed to be human readable/developer friendly. The custom_json_operation is larger than custom_operation or custom_binary, that is why it costs more RC. It should be signed as required in { required_auths } or { required_posting_auths }. The examples of custom_json_operation: - reblog - muted - pinned - follow
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/18_custom_json.md?ref_type=heads
decline_voting_rights
¶
decline_voting_rights(
*, account: str | None = ..., decline: bool | None = ...
)
Bases: Message
Using the operation decline_voting_rights_operation, a user may decide to decline their voting rights – for content, witnesses and proposals. Additionally, a user cannot set a proxy (operation account_witness_proxy_operation). The operation is done with a HIVE_OWNER_AUTH_RECOVERY_PERIOD day delay. After HIVE_OWNER_AUTH_RECOVERY_PERIOD days it is irreversible. During HIVE_OWNER_AUTH_RECOVERY_PERIOD days after creation, the operation may be canceled using the operation declive_voting_rights_operation with {decline = false}.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/36_decline_voting_rights.md?ref_type=heads
delegate_vesting_shares
¶
delegate_vesting_shares(
*,
delegator: str | None = ...,
delegatee: str | None = ...,
vesting_shares: asset | None = ...
)
Bases: Message
The operation delegate_vesting_shares_operation allows to delegate an amount of { vesting_shares } to an { delegatee } account. The { vesting_shares } are still owned by { delegator }, but the voting rights and resource credit are transferred. A user may not delegate: - the vesting shares that are already delegated - the delegated vesting shares to him (a user does not own them) - the vesting shares in the Power down process - the already used voting shares for voting or downvoting In order to remove the vesting shares delegation, the operation delegate_vesting_shares_operation should be created with {vesting_shares = 0}. When a delegation is removed, the delegated vesting shares are frozen for five days (HIVE_DELEGATION_RETURN_PERIOD_HF20) to prevent voting twice.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/40_delegate_vesting_shares.md?ref_type=heads
delegatee
instance-attribute
¶
delegatee: str
@param {string} delegatee - The account receiving vesting shares.
delegator
instance-attribute
¶
delegator: str
@param {string} delegator - The account delegating vesting shares.
vesting_shares
property
¶
vesting_shares: asset
@param {asset} vesting_shares - The amount of vesting shares to be delegated. Minimal amount = 1/3 of the fee for creating a new account.
delete_comment
¶
delete_comment(
*, author: str | None = ..., permlink: str | None = ...
)
Bases: Message
The post or comment may be deleted by the author. If the post or comment is deleted, the {permlink} may be reused. The delete doesn’t mean that the comment is removed from the blockchain.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/17_delete_comment.md?ref_type=heads
effective_comment_vote
¶
effective_comment_vote(
*,
voter: str | None = ...,
author: str | None = ...,
permlink: str | None = ...,
weight: int | None = ...,
rshares: int | None = ...,
total_vote_weight: int | None = ...,
pending_payout: asset | None = ...
)
Bases: Message
Related to vote_operation. Generated every time vote is cast for the first time or edited, but only as long as it is effective, that is, the target comment was not yet cashed out.
pending_payout
property
¶
pending_payout: asset
@param {asset} pending_payout - (HBD) estimated reward on target comment; supplemented by AH RocksDB plugin
total_vote_weight
instance-attribute
¶
total_vote_weight: int
@param {number} total_vote_weight - sum of all vote weights on the target comment in the moment of casting current vote
weight
instance-attribute
¶
weight: int
@param {number} weight - weight of vote depending on when vote was cast and with what power
escrow_approve
¶
escrow_approve(
*,
from_account: str | None = ...,
to_account: str | None = ...,
agent: str | None = ...,
who: str | None = ...,
escrow_id: int | None = ...,
approve: bool | None = ...
)
Bases: Message
The operation escrow_approve_operation is used to approve the escrow. The approval should be done by { to } and by the { agent }. The escrow approval is irreversible. If { agent } or { to } haven’t approved the escrow before the { ratification_deadline} or either of them explicitly rejected the escrow, the escrow is rejected. If {agent} and {to} have approved the escrow, the {fee} is transferred from temporary balance to {agent} account.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/31_escrow_approve.md?ref_type=heads
approve
instance-attribute
¶
approve: bool
@param {bool} approve - approve = true; (approve = false explicitly rejects the escrow)
escrow_dispute
¶
escrow_dispute(
*,
from_account: str | None = ...,
to_account: str | None = ...,
agent: str | None = ...,
who: str | None = ...,
escrow_id: int | None = ...
)
Bases: Message
The operation escrow_dispute_operation is used to raise the dispute. It may be used by { from } or { to } accounts. If there is a dispute, only {agent} may release the funds.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/28_escrow_dispute.md?ref_type=heads
escrow_rejected
¶
escrow_rejected(
*,
from_account: str | None = ...,
to_account: str | None = ...,
agent: str | None = ...,
escrow_id: int | None = ...,
hbd_amount: asset | None = ...,
hive_amount: asset | None = ...,
fee: asset | None = ...
)
Bases: Message
Related to escrow_approve_operation and escrow_transfer_operation. Generated when pending escrow transfer is cancelled and user that initiated it receives all the funds back. It can happen with explicit rejection with use of first operation. Can also happen during block processing when either agent or to account failed to approve before ratification deadline. @see escrow_approved
agent
instance-attribute
¶
agent: str
@param {string} agent - user that was designated as agent of cancelled escrow transfer
escrow_id
instance-attribute
¶
escrow_id: int
@param {number} escrow_id - id of cancelled escrow transfer
fee
property
¶
fee: asset
@param {asset} fee - (HIVE of HBD) fee from cancelled escrow transfer (same amount as in escrow_transfer_operation)
from_account
instance-attribute
¶
from_account: str
@param {string} from_account - user that initiated escrow transfer (receiver of all the funds)
hbd_amount
property
¶
hbd_amount: asset
@param {asset} hbd_amount - (HBD) funds from cancelled escrow transfer (same amount as in escrow_transfer_operation)
hive_amount
property
¶
hive_amount: asset
@param {asset} hive_amount - (HIVE) funds from cancelled escrow transfer (same amount as in escrow_transfer_operation)
to_account
instance-attribute
¶
to_account: str
@param {string} to_account - user that was target of cancelled escrow transfer
escrow_release
¶
escrow_release(
*,
from_account: str | None = ...,
to_account: str | None = ...,
agent: str | None = ...,
who: str | None = ...,
receiver: str | None = ...,
escrow_id: int | None = ...,
hbd_amount: asset | None = ...,
hive_amount: asset | None = ...
)
Bases: Message
The operation is used to release the funds of the escrow. The escrow may be released by { from }, { to } or { agent } – depending on the following conditions: If there is no dispute and escrow has not expired, either party can release funds to the other. If escrow expires and there is no dispute, either party can release funds to either party. If there is a dispute regardless of expiration, the agent can release funds to either party following whichever agreement was in place between the parties.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/29_escrow_release.md?ref_type=heads
hive_amount
property
¶
hive_amount: asset
@param {asset} hive_amount - The amount of HIVE to release.
receiver
instance-attribute
¶
receiver: str
@param {string} receiver - The account that should receive funds (might be {from}, might be {to}).
who
instance-attribute
¶
who: str
@param {string} who - The account that is attempting to release the funds.
escrow_transfer
¶
escrow_transfer(
*,
from_account: str | None = ...,
to_account: str | None = ...,
agent: str | None = ...,
escrow_id: int | None = ...,
hbd_amount: asset | None = ...,
hive_amount: asset | None = ...,
fee: asset | None = ...,
ratification_deadline: str | None = ...,
escrow_expiration: str | None = ...,
json_meta: str | None = ...
)
Bases: Message
The escrow allows the account { from_account } to send money to an account { to_account } only if the agreed terms will be fulfilled. In case of dispute { agent } may divide the funds between { from } and { to }. The escrow lasts up to { escrow_expiration }. When the escrow is created, the funds are transferred {from} to a temporary account. The funds are on the temporary balance, till the operation escrow_release_operation is created. To create an valid escrow: 1. Sender { from } creates the escrow using the operation: escrow_transfer_operation indicated { to } and { agent }. 2. The { agent } and { to } have up to { ratification_deadline } for approving the escrow using operation: escrow_approve_operation. If there is a dispute, the operation: escrow_dispute_operation should be used. In case of the escrow releases, the operation: escrow_release_operation should be used.
Descritpion https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/27_escrow_transfer.md?ref_type=heads
escrow_expiration
instance-attribute
¶
escrow_expiration: str
@param {string} escrow_expiration - See description of escrow_release_operation.
escrow_id
instance-attribute
¶
escrow_id: int
@param {number} escrow_id - It is defined by the sender. It should be unique for { from }.
fee
property
¶
fee: asset
@param {asset} fee - The fee amount depends on the agent. The fee is paid to the agent when approved.
ratification_deadline
instance-attribute
¶
ratification_deadline: str
@param {string} ratification_deadline - Time for approval for { to } and { agent }. If the escrow is not approved till { ratification_deadline }, it will be rejected and all funds returned to { from }.
feed_publish
¶
feed_publish(
*,
publisher: str | None = ...,
exchange_rate: price | None = ...
)
Bases: Message
This is an operation for witnesses. The witnesses publish the exchange rate between Hive and HBD. Only the exchange rate published by the top 20 witnesses is used to define the exchange rate.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/07_feed_publish.md?ref_type=heads
limit_order_cancel
¶
limit_order_cancel(
*, owner: str | None = ..., orderid: int | None = ...
)
Bases: Message
Cancels an order (limit_order_create_operation or limit_order_create2_operation) and returns the balance to the owner.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/06_limit_order_cancel.md?ref_type=heads
limit_order_create
¶
limit_order_create(
*,
owner: str | None = ...,
orderid: int | None = ...,
amount_to_sell: asset | None = ...,
min_to_receive: asset | None = ...,
fill_or_kill: bool | None = ...,
expiration: str | None = ...
)
Bases: Message
This operation creates a limit order and matches it against existing open orders. It allows to sell Hive and buy HBD or sell HBD and buy Hive. It is a way for a user to declare they want to sell {amount_to_sell} Hive/HBD for at least {min_to_receive} HBD/Hive. The user may be a taker (if a user creates an order and the order matches some order(s)) or a maker (if a user creates an order and the order doesn’t match and the order is waiting for a match on the market). If there is a partial match, a user may be a taker and maker for the same order. If a taker creates an order for all orders on the market the order(s) that are the best deal for the taker are matched. If there are two orders with the same price, the older one is matched. The operation is used by the markets see: https://wallet.hive.blog/market
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/05_limit_order_create.md?ref_type=heads
fill_or_kill
instance-attribute
¶
fill_or_kill: bool
@param {bool} fill_or_kill - If fill_or_kill = true, then the operation is executed immediately or it fails (the operation is not added to the block). If fill_or_kill = false, then the order is valid till 'expiration'.
orderid
instance-attribute
¶
orderid: int
@param {number} orderid - an ID assigned by owner, must be unique.
limit_order_create2
¶
limit_order_create2(
*,
owner: str | None = ...,
orderid: int | None = ...,
amount_to_sell: asset | None = ...,
fill_or_kill: bool | None = ...,
exchange_rate: price | None = ...,
expiration: str | None = ...
)
Bases: Message
This operation creates a limit order and matches it against existing open orders. It is similar to limit_order_create except it serializes the price rather than calculating it from other fields. It allows to sell Hive and buy HBD or sell HBD and buy Hive. It is a way for a user to declare they wants to sell {amount_to_sell} Hive/HBD for at least {exchange_rate} per HBD/Hive.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/21_limit_order_create2.md?ref_type=heads
fill_or_kill
instance-attribute
¶
fill_or_kill: bool
@param {bool} fill_or_kill - If fill_or_kill = true, then the operation is executed immediately or it fails (the operation is not added to the block). If fill_or_kill = false, then the order is valid till {expiration}.
orderid
instance-attribute
¶
orderid: int
@param {number} orderid - an ID assigned by owner, must be unique.
operation
¶
operation(
*,
vote: vote | None = ...,
comment: comment | None = ...,
transfer: transfer | None = ...,
transfer_to_vesting: transfer_to_vesting | None = ...,
withdraw_vesting: withdraw_vesting | None = ...,
limit_order_create: limit_order_create | None = ...,
limit_order_cancel: limit_order_cancel | None = ...,
feed_publish: feed_publish | None = ...,
convert: convert | None = ...,
account_create: account_create | None = ...,
account_update: account_update | None = ...,
witness_update: witness_update | None = ...,
account_witness_vote: account_witness_vote | None = ...,
account_witness_proxy: account_witness_proxy
| None = ...,
pow: pow | None = ...,
custom: custom | None = ...,
witness_block_approve: witness_block_approve
| None = ...,
delete_comment: delete_comment | None = ...,
custom_json: custom_json | None = ...,
comment_options: comment_options | None = ...,
set_withdraw_vesting_route: set_withdraw_vesting_route
| None = ...,
limit_order_create2: limit_order_create2 | None = ...,
claim_account: claim_account | None = ...,
create_claimed_account: create_claimed_account
| None = ...,
request_account_recovery: request_account_recovery
| None = ...,
recover_account: recover_account | None = ...,
change_recovery_account: change_recovery_account
| None = ...,
escrow_transfer: escrow_transfer | None = ...,
escrow_dispute: escrow_dispute | None = ...,
escrow_release: escrow_release | None = ...,
pow2: pow2 | None = ...,
escrow_approve: escrow_approve | None = ...,
transfer_to_savings: transfer_to_savings | None = ...,
transfer_from_savings: transfer_from_savings
| None = ...,
cancel_transfer_from_savings: cancel_transfer_from_savings
| None = ...,
decline_voting_rights: decline_voting_rights
| None = ...,
claim_reward_balance: claim_reward_balance | None = ...,
delegate_vesting_shares: delegate_vesting_shares
| None = ...,
account_create_with_delegation: account_create_with_delegation
| None = ...,
witness_set_properties: witness_set_properties
| None = ...,
account_update2: account_update2 | None = ...,
create_proposal: create_proposal | None = ...,
update_proposal_votes: update_proposal_votes
| None = ...,
remove_proposal: remove_proposal | None = ...,
update_proposal: update_proposal | None = ...,
collateralized_convert: collateralized_convert
| None = ...,
recurrent_transfer: recurrent_transfer | None = ...,
fill_convert_request: fill_convert_request | None = ...,
author_reward: author_reward | None = ...,
curation_reward: curation_reward | None = ...,
comment_reward: comment_reward | None = ...,
liquidity_reward: liquidity_reward | None = ...,
interest: interest | None = ...,
fill_vesting_withdraw: fill_vesting_withdraw
| None = ...,
fill_order: fill_order | None = ...,
shutdown_witness: shutdown_witness | None = ...,
fill_transfer_from_savings: fill_transfer_from_savings
| None = ...,
hardfork: hardfork | None = ...,
comment_payout_update: comment_payout_update
| None = ...,
return_vesting_delegation: return_vesting_delegation
| None = ...,
comment_benefactor_reward: comment_benefactor_reward
| None = ...,
producer_reward: producer_reward | None = ...,
clear_null_account_balance: clear_null_account_balance
| None = ...,
proposal_pay: proposal_pay | None = ...,
dhf_funding: dhf_funding | None = ...,
hardfork_hive: hardfork_hive | None = ...,
hardfork_hive_restore: hardfork_hive_restore
| None = ...,
delayed_voting: delayed_voting | None = ...,
consolidate_treasury_balance: consolidate_treasury_balance
| None = ...,
effective_comment_vote: effective_comment_vote
| None = ...,
ineffective_delete_comment: ineffective_delete_comment
| None = ...,
dhf_conversion: dhf_conversion | None = ...,
expired_account_notification: expired_account_notification
| None = ...,
changed_recovery_account: changed_recovery_account
| None = ...,
transfer_to_vesting_completed: transfer_to_vesting_completed
| None = ...,
pow_reward: pow_reward | None = ...,
vesting_shares_split: vesting_shares_split | None = ...,
account_created: account_created | None = ...,
fill_collateralized_convert_request: fill_collateralized_convert_request
| None = ...,
system_warning: system_warning | None = ...,
fill_recurrent_transfer: fill_recurrent_transfer
| None = ...,
failed_recurrent_transfer: failed_recurrent_transfer
| None = ...,
limit_order_cancelled: limit_order_cancelled
| None = ...,
producer_missed: producer_missed | None = ...,
proposal_fee: proposal_fee | None = ...,
collateralized_convert_immediate_conversion: collateralized_convert_immediate_conversion
| None = ...,
escrow_approved: escrow_approved | None = ...,
escrow_rejected: escrow_rejected | None = ...,
proxy_cleared: proxy_cleared | None = ...,
declined_voting_rights: declined_voting_rights
| None = ...
)
Bases: Message
NOTE: do not change the order of any operations prior to the virtual operations or it will trigger a hardfork.
recover_account
¶
recover_account(
*,
account_to_recover: str | None = ...,
new_owner_authority: authority | None = ...,
recent_owner_authority: authority | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
This operation is part of the recovery account process (more information in request_account_recovery). After creating by recovery account the operation request_account_recovery, the user has HIVE_ACCOUNT_RECOVERY_REQUEST_EXPIRATION_PERIOD hours to respond using operation recover_account_operation and set a new owner authority. The operation recover_account_operation has to be signed using the two owner authorities, the old one (maybe compromised) and the new one (see request_account_recovery). There must be at least 60 minutes (HIVE_OWNER_UPDATE_LIMIT) between executions of operation recover_account_operation.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/25_recover_account.md?ref_type=heads
account_to_recover
instance-attribute
¶
account_to_recover: str
@param {string} account_to_recover - The account to be recovered.
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions - Not currently used.
new_owner_authority
property
¶
new_owner_authority: authority
@param {authority} new_owner_authority - The new owner authority as specified in the request account recovery operation.
recent_owner_authority
property
¶
recent_owner_authority: authority
@param {authority} recent_owner_authority - A previous owner's authority, may be compromised. If the operation change_recovery_account_operation was generated, it has not been yet 30 days since its creation.
recurrent_transfer
¶
recurrent_transfer(
*,
from_account: str | None = ...,
to_account: str | None = ...,
amount: asset | None = ...,
memo: str | None = ...,
recurrence: int | None = ...,
executions: int | None = ...,
extensions: Iterable[
global___recurrent_transfer_extension
]
| None = ...
)
Bases: Message
Creates/updates/removes a recurrent transfer in the currency Hive or HBD. Since HF 28, if user has more than one recurrent transfer to the same receiver or if user creates the recurrent transfer using pair_id in the extensions, user has to specify the pair_id in order to update or remove the defined recurrent transfer. - If amount is set to 0, the recurrent transfer will be deleted and the virtual operation fill_recurrent_transfer_operation is not generated - If there is already a recurrent transfer matching 'from' and 'to', the recurrent transfer will be replaced, but: - If the 'recurrence' is not changed, the next execution will be according to “old definition” - If the 'recurrence' is changed, then the next execution will be “update date” + 'recurrence' there is no execution on the update date. - Up to HF28 there can be only one recurrent transfer for sender 'from' and receiver 'to'. Since H28 users may define more recurrent transfers to the same sender and receiver using pair_id in the 'executions'. - The one account may define up to 255 recurrent transfers to other accounts. - The execution date of the last transfer should be no more than 730 days in the future.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/49_recurrent_transfer.md?ref_type=heads
amount
property
¶
amount: asset
@param {asset} amount - The amount of asset to transfer from @ref from to @ref to. If the recurrent transfer failed 10 (HIVE_MAX_CONSECUTIVE_RECURRENT_TRANSFER_FAILURES) times because of the lack of funds, the recurrent transfer will be deleted. Allowed currency: Hive and HBD.
executions
instance-attribute
¶
executions: int
@param {number} executions - How many times the recurrent payment will be executed. Executions must be at least 2, if you set executions to 1 the recurrent transfer will not be executed.
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
global___recurrent_transfer_extension
]
@param {recurrent_transfer_extension} extensions - Extensions. Since HF 28 it may contain the 'pair_id'. It allows to define more than one recurrent transfer from sender to the same receiver 'to'. Default value 'pair_id=0'.
recurrence
instance-attribute
¶
recurrence: int
@param {number} recurrence - How often will the payment be triggered, unit: hours. The first transfer is executed immediately. The minimum value of the parameter is 24 h.
to_account
instance-attribute
¶
to_account: str
@param {string} to_account - Account to transfer asset to. Cannot set a transfer to yourself.
remove_proposal
¶
remove_proposal(
*,
proposal_owner: str | None = ...,
proposal_ids: Iterable[int] | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
Using operation remove_proposal_operation, a user may remove proposals specified by given IDs.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/46_remove_proposal.md?ref_type=heads
request_account_recovery
¶
request_account_recovery(
*,
recovery_account: str | None = ...,
account_to_recover: str | None = ...,
new_owner_authority: authority | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
In case of the compromised owner authority, a user may recover it. There are two conditions that have to be fulfilled to do it: 1. A user should have an actual recovery account. During an account creation, the account that created a new account is set as a recovery account by default, but it can be changed by the user (using operation change_recovery_account_operation). If the account was created by account temp, then a recovery account is empty and it is set as a top witness – it is not good a recovery account. Note: it takes HIVE_OWNER_AUTH_RECOVERY_PERIOD (30 days) after sending change_recovery_account_operation. for the new recovery agent to become active. During that period the previous agent remains active for the account. 2. The compromised owner authority is still recent. Owner authority is considered recent and remains valid for the purpose of account recovery for HIVE_OWNER_AUTH_RECOVERY_PERIOD (30 days) after it was changed.
Note: look for account_update_operation or account_update2_operation in account history to see when its owner authority was compromised.
The recovery account process. Conditions: 1. An account { account_to_recover } has an actual recovery account. 2. An account { account_to_recover } realizes that someone may have access to its owner key and it is less than 30 days from generating an operation: change_recovery_account_operation. Steps: A user { account_to_recover } asks his recovery account { recovery_account } to create a request account recovery (outside the blockchain). A recovery account { recovery_account } creates an operation: request_account_recovery_operation with {new_owner_authority}. A user { account_to_recover } creates an operation: recover_account_operation using { new_owner_authority} and {recent_owner_authority} and signing with two signatures (the old one and the new one). A user has HIVE_ACCOUNT_RECOVERY_REQUEST_EXPIRATION_PERIOD to generate this operation.
In order to cancel a request, a user should create a new request with weight of authority =0. The operation: request_account_recovery is valid HIVE_ACCOUNT_RECOVERY_REQUEST_EXPIRATION_PERIOD hours and if after HIVE_ACCOUNT_RECOVERY_REQUEST_EXPIRATION_PERIOD hours there is no response (operation: recover_account_operation) it is expired.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/24_request_account_recovery.md?ref_type=heads
account_to_recover
instance-attribute
¶
account_to_recover: str
@param {string} account_to_recover - The account to be recovered.
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions - Not currently used.
new_owner_authority
property
¶
new_owner_authority: authority
@param {authority} new_owner_authority - The new owner authority – the public, not private key. The new authority should be satisfiable.
recovery_account
instance-attribute
¶
recovery_account: str
@param {string} recovery_account - The account that may create a request for account recovery. It is important to keep it actual.
set_withdraw_vesting_route
¶
set_withdraw_vesting_route(
*,
from_account: str | None = ...,
to_account: str | None = ...,
percent: int | None = ...,
auto_vest: bool | None = ...
)
Bases: Message
The operation set_withdraw_vesting_route_operation allows a user to decide where and how much percent of hive should be transferred to the account { to_account } from power down operation. A user may also decide that the Hive may be immediately converted to Hive Power. The operation may be created in any moment of power down operation and even if there is no power down operation in progress. The setting is valid till a user creates an operation set_withdraw_vesting_route_operation with the same { to_account} and with the {percent} = 0. A user may set up 10 { to_account } accounts.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/20_set_withdraw_vesting_route.md?ref_type=heads
auto_vest
instance-attribute
¶
auto_vest: bool
@param {bool} auto_vest - If auto_vest = true, then the amount of the Hive is immediately converted into HP on the { to_account } balance. If auto_vest = false, there is no conversion from Hive into HP. Default auto_vest = false;
from_account
instance-attribute
¶
from_account: str
@param {string} from_account - The account the funds are coming from.
percent
instance-attribute
¶
percent: int
@param {number} percent - The percentage of the HP shares. If the sum of the setting shares is less than 100%, the rest is transferred to the liquid balance of { from_account }. Default value: percent = 0;
to_account
instance-attribute
¶
to_account: str
@param {string} to_account - The account the funds are going to. A user may set up 10 accounts.
transfer
¶
transfer(
*,
from_account: str | None = ...,
to_account: str | None = ...,
amount: asset | None = ...,
memo: str | None = ...
)
Bases: Message
@brief Transfers any liquid asset (nonvesting) from one account to another.
Transfer funds from 'from_account' to 'to_account'. HIVE and HBD can be transferred. Memo for the transaction can be encrypted if message is started with '#'. Private Memo Key must already be in the wallet for encrypted memo to work.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/02_transfer.md?ref_type=heads
amount
property
¶
amount: asset
@param {asset} amount - The amount of asset to transfer from @ref from_account to @ref to_account, the allowed currency: HIVE and HBD.
from_account
instance-attribute
¶
from_account: str
@param {string} from_account - The account the funds are coming from.
memo
instance-attribute
¶
memo: str
@param {string} memo - The memo is plain-text, any encryption on the memo is up to a higher level protocol, must be shorter than 2048.
to_account
instance-attribute
¶
to_account: str
@param {string} to_account - The account the funds are going to.
transfer_from_savings
¶
transfer_from_savings(
*,
from_account: str | None = ...,
request_id: int | None = ...,
to_account: str | None = ...,
amount: asset | None = ...,
memo: str | None = ...
)
Bases: Message
Funds withdrawals from the savings to an account take three days.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/33_transfer_from_savings.md?ref_type=heads
amount
property
¶
amount: asset
@param {asset} amount - The allowed currency: HIVE and HBD, amount > 0.
memo
instance-attribute
¶
memo: str
@param {string} memo - Have to be UTF8, must be shorter than 2048.
request_id
instance-attribute
¶
request_id: int
@param {number} request_id - The number is given by a user. Should be unique for a user.
transfer_to_savings
¶
transfer_to_savings(
*,
from_account: str | None = ...,
to_account: str | None = ...,
amount: asset | None = ...,
memo: str | None = ...
)
Bases: Message
A user can place Hive and Hive Dollars into savings balances. Funds can be withdrawn from these balances after a three day delay. Keeping funds on the savings balance mitigates loss from hacked and compromised accounts. The maximum amount a user can lose instantaneously is the sum of what they hold in liquid balances. Assuming an account can be recovered quickly, loss in such situations can be kept to a minimum Additionally for keeping Hive Dollars on the savings balance, the interests are calculated.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/32_transfer_to_savings.md?ref_type=heads
amount
property
¶
amount: asset
@param {asset} amount - The allowed currency: HIVE and HBD, amount > 0.
from_account
instance-attribute
¶
from_account: str
@param {string} from_account - The account the funds are coming from.
memo
instance-attribute
¶
memo: str
@param {string} memo - Have to be UTF8, must be shorter than 2048.
to_account
instance-attribute
¶
to_account: str
@param {string} to_account - The account the funds are going to. The funds may be transferred to someone else savings balance.
transfer_to_vesting
¶
transfer_to_vesting(
*,
from_account: str | None = ...,
to_account: str | None = ...,
amount: asset | None = ...
)
Bases: Message
The operation is also called Staking. This operation converts Hive into Hive Power (also called Vesting Fund Shares or VESTS) at the current exchange rate. The conversion may be done between the same account or to another account. The more HP (Hive Power) the account has, the more: a. Governance voting power (for witnesses and proposals) has b. Social voting power has (indirectly affects Increase curation rewards) c. Resource Credit has
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/03_transfer_to_vesting.md?ref_type=heads
update_proposal
¶
update_proposal(
*,
proposal_id: int | None = ...,
creator: str | None = ...,
daily_pay: asset | None = ...,
subject: str | None = ...,
permlink: str | None = ...,
extensions: Iterable[global___update_proposal_extension]
| None = ...
)
Bases: Message
A user who created the proposal may update it. A user may decrease {daily_pay}, change subject, permlink and {end_date} (using {extensions}). In order to update the proposal parameters, all parameters should be entered.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/47_update_proposal.md?ref_type=heads
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
global___update_proposal_extension
]
@param {update_proposal_extension} extensions
update_proposal_votes
¶
update_proposal_votes(
*,
voter: str | None = ...,
proposal_ids: Iterable[int] | None = ...,
approve: bool | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
A user may vote for proposals directly using an operation: update_proposal_votes_operation, or indirectly using the proxy - operation: account_witness_proxy_operation. A user may vote for proposals submitted by the other users. By voting for the proposal, a user may select which proposals should be funded. A user may vote for as many proposals as they wants, but you cannot vote twice for the same proposal. If a proxy is specified then all existing votes are deactivated. When the proxy is removed, the votes will be activated. Your vote power depends on your HP. If the operation account_witness_vote_operation or account_witness_proxy_operation or update_proposal_votes_operation is not executed in HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD, the votes are removed and the virtual operation: expired_account_notification_operation is generated.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/45_update_proposal_votes.md?ref_type=heads
approve
instance-attribute
¶
approve: bool
@param {bool} approve - To vote for the proposal, the approve = true. To remove the vote, the approve = false.
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions
proposal_ids
property
¶
proposal_ids: RepeatedScalarFieldContainer[int]
@param {number} proposal_ids - IDs of proposals to vote for/against. Before HF28 nonexisting IDs are ignored from HF28 they trigger an error.
vote
¶
vote(
*,
voter: str | None = ...,
author: str | None = ...,
permlink: str | None = ...,
weight: int | None = ...
)
Bases: Message
A user may upvote or downvote a post or a comment.
A user has a voting power. The max voting power depends on HP.
There are two manabars related to voting: Voting manabar and Downvoting manabar. Voting and downvoting manabars are defined as a percentage of total vote weight. Downvote manabar has 25% of the vote power weight and vote manabar has 100% of the vote power weight, but a user downvote with the total vote weight (not 25 %, but 100%).
When a user casts a vote, 1/50th of the remaining mana is used for a 100% vote. The voting powers regenerate from 0 to 100% in 5 days (20% per day).
If a voter casts another vote for the same post or comment before rewards are paid, it counts as vote edit. Vote edit cancels all effects of previous vote and acts as completely new vote, except mana used for previous vote is not returned.
The author of the post or the comment may receive the reward, the amount of the author's reward depends on the numbers and powers of the votes. By default the author reward is paid 50% HP and 50 % HBD.
A user who votes for the post or the comment may receive the curation reward. It is paid 100% HP. Its share depends on: - voting power - weight of the vote – a user may decide about the weight of the vote - the time when they vote – the sooner you vote, the higher the share in the curation reward (the first 24 h the weight of the vote is 100% - early voting, next 48 hours the weight is divided by 2, then – till the 7th day - it is divided by 8)
When a post or a comment receives a reward, it is divided between the author's reward and the curation reward. The curation reward is shared among curators.
The calculated reward should be more than 0.02 HBD to be paid, if it is less, it is not paid.
A downvoting user doesn’t receive the curation reward. Downvoting may affect the author of the comment's reputation when a user who downvotes has a higher reputation than the author.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/00_vote.md?ref_type=heads
author
instance-attribute
¶
author: str
@param {string} author - Account name, the author of the post or the comment.
permlink
instance-attribute
¶
permlink: str
@param {string} permlink - The identifier of the post or comment.
weight
instance-attribute
¶
weight: int
@param {number} weight - It defines how many percent of the non-used voting power a user wants to use. Allowed values from -10000 (-100%) to 10000 (100%). Downvotes: from -10000 (-100%) to 0. Upvotes: from 0 to 10000 (100%).
withdraw_vesting
¶
withdraw_vesting(
*,
account: str | None = ...,
vesting_shares: asset | None = ...
)
Bases: Message
This operation converts Hive Power (also called Vesting Fund Shares or VESTS) into HIVE. At any given point in time an account can be withdrawing from their vesting shares. A user may change the number of shares they wish to cash out at any time between 0 and their total vesting stake. After applying this operation, vesting_shares will be withdrawn at a rate of vesting_shares/13 per week for 13 weeks starting one week after this operation is included in the blockchain. This operation is not valid if a user has no vesting shares. There can be only one withdraw_vesting_operation processed at the same time. If a user wants to stop withdraw_vesting_operation, they should create an operation withdraw_vesting_operation with amount =0. If a user creates a new withdraw_vesting_operation when the old one is still processed, then the old withdraw_vesting_operation will be canceled and a new one will be processed.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/04_withdraw_vesting.md?ref_type=heads
witness_block_approve
¶
witness_block_approve(
*, witness: str | None = ..., block_id: str | None = ...
)
Bases: Message
This is an operation for witnesses. This operation is used in the process of block_validity_vote (see https://hive.blog/hive-139531/@blocktrades/one-block-irreversibility-for-delegated-proof-of-stake-dpos).
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/16_witness_block_approve.md?ref_type=heads
witness_set_properties
¶
witness_set_properties(
*,
owner: str | None = ...,
props: Mapping[str, str] | None = ...,
extensions: Iterable[future_extensions] | None = ...
)
Bases: Message
This is an operation for witnesses. This is one of the two operations allowing to update witness properties (@see witness_update_operation). The whole list of properties is available here: https://gitlab.syncad.com/hive/hive/-/blob/master/doc/witness_parameters.md.
Description https://gitlab.syncad.com/hive/hive/-/blob/develop/doc/devs/operations/42_witness_set_properties.md?ref_type=heads
extensions
property
¶
extensions: RepeatedCompositeFieldContainer[
future_extensions
]
@param {future_extensions} extensions
props
property
¶
props: ScalarMap[str, str]
@param {map
witness_update
¶
witness_update(
*,
owner: str | None = ...,
url: str | None = ...,
block_signing_key: str | None = ...,
props: legacy_chain_properties | None = ...,
fee: asset | None = ...
)
Bases: Message
The operation witness_update_operation may be used to become a new witness or to update witness properties. There are two operations that allow to update witness properties witness_update_operation and witness_set_properties_operation. In order to update witness properties it is recommended to use witness_set_properties_operation.
If a user wants to become a witness, the operation witness_update_operation should be created. If the witness doesn’t want to be a witness any more, the operation witness_update_operation with empty { block_signing_key } should be created.
block_signing_key
instance-attribute
¶
block_signing_key: str
@param {string} block_signing_key - Public block signing key.
fee
property
¶
fee: asset
@param {asset} fee - The asset is validated (the format should be correct and should be expressed in Hive), but the fee is currently ignored.
owner
instance-attribute
¶
owner: str
@param {string} owner - The witness who wants to update properties or a user who wants to become a witness.
wax_factory
¶
create_hive_chain
¶
create_hive_chain(
options: WaxChainOptions | None = None,
) -> IHiveChainInterface[ApiCollectionT | WaxApiCollection]
Factory function to provide hive chain interface functionality.
Source code in wax/wax_factory.py
21 22 23 24 25 26 27 |
|
create_wax_foundation
¶
create_wax_foundation(
options: WaxOptions | None = None,
) -> IWaxBaseInterface
Factory function to provide wax base interface functionality.
Source code in wax/wax_factory.py
14 15 16 17 18 |
|
wax_options
¶
WaxChainOptions
¶
WaxChainOptions(
chain_id: ChainId | str = DEFAULT_CHAIN_ID,
endpoint_url: HttpUrl | str = DEFAULT_ENDPOINT_URL,
)
Bases: WaxOptions
Allows configuration of wax itself, including chain part.
Constructs WaxChainOptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ChainId | str
|
chain id used for signing. Defaults to mainnet chain id. |
DEFAULT_CHAIN_ID
|
|
HttpUrl | str
|
url of the node to connect to. Defaults to mainnet (hive.blog) node. |
DEFAULT_ENDPOINT_URL
|
Raises:
Type | Description |
---|---|
InvalidEndpointUrlFormatError
|
if endpoint_url is not valid. |
Source code in wax/wax_options.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
WaxOptions
¶
Allows configuration of wax itself.
Constructs WaxOptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ChainId
|
chain id used for signing. Defaults to mainnet chain id. |
DEFAULT_CHAIN_ID
|
Source code in wax/wax_options.py
16 17 18 19 20 21 22 23 |
|
wax_visitor
¶
AbstractOperationVisitor
¶
OperationVisitor
¶
Bases: AbstractOperationVisitor
User need to override only method(s) for operation(s) he wants to be processed.
All other operations will be silently skipped.