Skip to content

Reference

wax

IHiveChainInterface

Bases: IWaxBaseInterface, Generic[ApiCollectionT]

api abstractmethod property

Returns the API collection object.

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
transaction
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
@abstractmethod
async def broadcast(self, transaction: ITransaction | IOnlineTransaction) -> None:
    """
    Broadcast transaction to the selected during Wax Chain initialization Hive Node.

    Args:
        transaction: Transaction object to be broadcasted.

    Raises:
        TransactionNotSignedError: When the transaction is not signed.
        WaxValidationFailedError: When the transaction is incorrect.
    """

collect_account_authorities abstractmethod async

collect_account_authorities(
    account: AccountName,
) -> WaxAccountAuthorityInfo

Collects account authorities.

Parameters:

Name Type Description Default
account
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
@abstractmethod
async def collect_account_authorities(self, account: AccountName) -> WaxAccountAuthorityInfo:
    """
    Collects account authorities.

    Args:
        account: Account name.

    Returns:
        WaxAccountAuthorityInfo: Account authority info.

    Raises:
        InvalidAccountNameError: When the account name is invalid.
        AccountNotFoundError: When the account is not found in the HIVE api node.
    """

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
expiration
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
@abstractmethod
async def create_transaction(self, expiration: TTimestamp | None = None) -> IOnlineTransaction:
    """
    Same as `IWaxBaseInterface.create_transaction_with_tapos` but pulls the reference block data from the remote.

    Args:
        expiration: time (UTC) till transaction is valid. Default to +1 minute.

    Returns:
        Transaction object

    Raises:
        AssertionError: when expiration is not valid type.
    """

extends abstractmethod

Extends the current API collection with a new one.

Parameters:

Name Type Description Default
new_api
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
@abstractmethod
def extends(
    self, new_api: type[ExtendedApiCollectionT]
) -> IHiveChainInterface[ExtendedApiCollectionT | ApiCollectionT]:
    """
    Extends the current API collection with a new one.

    Args:
        new_api: New API collection class to be added.

    Returns:
        IHiveChainInterface: 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
    """

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
operation
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
@abstractmethod
def push_operation(self, operation: WaxMetaOperation) -> Self:
    """
    Pushes given operation into the transaction (exactly to the list of operations).

    Args:
        operation: Operation to be pushed into the transaction in dict or proto format.

    Examples:
        * Proto format:
        transaction.push_operation(vote_pb2.vote(voter="alice", author="bob", permlink="/", weight=11))

    Returns:
        Self: current transaction instance.
    """

IWaxBaseInterface

Bases: ABC

address_prefix abstractmethod property

address_prefix: str

Returns the public key address prefix.

chain_id abstractmethod property

chain_id: ChainId

Returns the chain id.

config abstractmethod property

config: ChainConfig

Returns protocol configuration for the current chain.

hbd abstractmethod property

Returns set of methods to create HBD asset.

hive abstractmethod property

Returns set of methods to create HIVE asset.

vests abstractmethod property

vests: AssetFactory

Returns set of methods to create VESTS asset.

calculate_account_hp abstractmethod

Calculates account HP based on given vests, total vesting fund HIVE and total vesting shares.

Parameters:

Name Type Description Default
vests
VestsNaiAssetConvertible

VESTS asset.

required
total_vesting_fund_hive
HiveNaiAssetConvertible

HIVE asset total vesting fund.

required
total_vesting_shares
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
@abstractmethod
def calculate_account_hp(
    self,
    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.

    Args:
        vests: VESTS asset.
        total_vesting_fund_hive: HIVE asset total vesting fund.
        total_vesting_shares: VESTS asset total vesting shares.

    Returns:
        NaiAsset: calculated HP for the given vests, total vesting fund HIVE and total vesting shares.

    Raises:
        UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset is incorrect.
    """

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
head_block_time
datetime

Head block time. Can be obtained using time property from dgpo (dynamic global properties)

required
max_mana
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
current_mana
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
last_update_time
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
@staticmethod
@abstractmethod
def calculate_current_manabar_value(
    head_block_time: datetime, max_mana: int, current_mana: int, last_update_time: int
) -> IManabarData:
    """
    Calculates of the current manabar.

    Args:
        head_block_time:
            Head block time. Can be obtained using time property from dgpo (dynamic global properties)
        max_mana:
            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.
        current_mana:
            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
        last_update_time:
            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.

    Returns:
        IManabarData: Calculated manabar value.

    Raises:
        WaxValidationFailedError: When passed parameters are wrong.
    """

calculate_hp_apr abstractmethod

Calculates HP APR.

Parameters:

Name Type Description Default
head_block_num
int

Head block number.

required
vesting_reward_percent
int

Vesting reward percent.

required
virtual_supply
HiveNaiAssetConvertible

Virtual supply.

required
total_vesting_fund_hive
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
@abstractmethod
def calculate_hp_apr(
    self,
    head_block_num: int,
    vesting_reward_percent: int,
    virtual_supply: HiveNaiAssetConvertible,
    total_vesting_fund_hive: HiveNaiAssetConvertible,
) -> Decimal:
    """
    Calculates HP APR.

    Args:
        head_block_num: Head block number.
        vesting_reward_percent: Vesting reward percent.
        virtual_supply: Virtual supply.
        total_vesting_fund_hive: Total vesting fund HIVE.

    Returns:
        Decimal: HP APR percent with 2 decimals

    Raises:
        WaxValidationFailedError: When passed parameters are wrong.
    """

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
head_block_time
datetime

Head block time. Can be obtained using time property from dgpo (dynamic global properties)

required
max_mana
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
current_mana
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
last_update_time
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
@staticmethod
@abstractmethod
def 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.

    Args:
        head_block_time:
            Head block time. Can be obtained using time property from dgpo (dynamic global properties)
        max_mana:
            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.
        current_mana:
            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
        last_update_time:
            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.

    Returns:
        datetime: Calculated manabar full regeneration time.

    Raises:
        WaxValidationFailedError: when passed parameters are wrong.
    """

calculate_witness_votes_hp abstractmethod

Calculates witness votes HP based on given votes, total vesting fund HIVE and total vesting shares.

Parameters:

Name Type Description Default
number
int

witness votes.

required
total_vesting_fund_hive
HiveNaiAssetConvertible

HIVE asset total vesting fund.

required
total_vesting_shares
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
@abstractmethod
def calculate_witness_votes_hp(
    self,
    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.

    Args:
        number: witness votes.
        total_vesting_fund_hive: HIVE asset total vesting fund.
        total_vesting_shares: VESTS asset total vesting shares.

    Returns:
        NaiAsset: Calculated votes in nai asset form.

    Raises:
         UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset is incorrect.
    """

create_transaction_from_json abstractmethod

create_transaction_from_json(
    transaction: JsonTransaction,
) -> ITransaction

Creates transaction object from JSON transaction.

Parameters:

Name Type Description Default
transaction
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
@abstractmethod
def create_transaction_from_json(self, transaction: JsonTransaction) -> ITransaction:
    """
    Creates transaction object from JSON transaction.

    Args:
        transaction: JSON transaction object.

    Returns:
        Transaction object

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """

create_transaction_from_proto abstractmethod

create_transaction_from_proto(
    transaction: ProtoTransaction,
) -> ITransaction

Creates transaction object from proto transaction.

Parameters:

Name Type Description Default
transaction
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
@abstractmethod
def create_transaction_from_proto(self, transaction: ProtoTransaction) -> ITransaction:
    """
    Creates transaction object from proto transaction.

    Args:
        transaction: Proto transaction object.

    Returns:
        Transaction object
    """

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
tapos_block_id
str

Block id (mostly head) that transaction should refer to

required
expiration
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
@abstractmethod
def create_transaction_with_tapos(self, tapos_block_id: str, expiration: TTimestamp | None = None) -> ITransaction:
    """
    Creates transaction object using basic information from chain.

    Args:
        tapos_block_id: Block id (mostly head) that transaction should refer to
        expiration: time (UTC) till transaction is valid. Default to +1 minute.

    Returns:
        Transaction object
    """

estimate_hive_collateral abstractmethod

Estimate hive collateral.

Parameters:

Name Type Description Default
current_median_history_base
HbdNaiAssetConvertible

Base for Current median price retrieved by get_feed_history

required
current_median_history_quote
HiveNaiAssetConvertible

Quote for Current median price retrieved by get_feed_history

required
current_min_history_base
HbdNaiAssetConvertible

Base for Current minimal price retrieved by get_feed_history

required
current_min_history_quote
HiveNaiAssetConvertible

Quote for Current minimal price retrieved by get_feed_history

required
hbd_amount_to_get
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
@abstractmethod
def estimate_hive_collateral(
    self,
    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.

    Args:
        current_median_history_base: Base for Current median price retrieved by `get_feed_history`
        current_median_history_quote: Quote for Current median price retrieved by `get_feed_history`
        current_min_history_base: Base for Current minimal price retrieved by `get_feed_history`
        current_min_history_quote:  Quote for Current minimal price retrieved by `get_feed_history`
        hbd_amount_to_get: HBD amount to get.

    Returns:
        NaiAsset: Estimated HIVE collateral.

    Raises:
        CannotCreateAssetError/UnknownAssetTypeError/AssertionError: When passed asset is incorrect.
    """

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

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
@staticmethod
@abstractmethod
def get_operation_impacted_accounts(operation: Operation) -> list[AccountName]:
    """
    Retrieves the list of account names (not authorities!) that are impacted by a given operation.

    Args:
        operation: Operation in HF26 format or proto operation.

    Returns:
        list[AccountName]: list of account names impacted in operation.

    Raises:
        InvalidOperationFormatError, WaxValidationFailedError: When operation is incorrect.
    """

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
account
AccountName

Account name.

required
role
str

active | owner | posting | memo.

required
password
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
@staticmethod
@abstractmethod
def get_private_key_from_password(account: AccountName, role: str, password: str) -> IPrivateKeyData:
    """
    Returns private key data.

    Args:
        account: Account name.
        role: active | owner | posting | memo.
        password: the Master Password to derive key from.

    Returns:
        PrivateKeyData: generated private key along with the associated public key in WIF format.
    """

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
sig_digest
Hex

Digest data in hexadecimal format.

required
signature
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
@staticmethod
@abstractmethod
def 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.

    Args:
        sig_digest: Digest data in hexadecimal format.
        signature: Signature in hexadecimal format.

    Returns:
        PublicKey: Public key used in the signature

    Raises:
        WaxValidationFailedError: When passed parameters are wrong.
    """

hbd_to_hive abstractmethod

Converts given HBD into HIVE, both in nai form.

Parameters:

Name Type Description Default
hbd
HbdNaiAssetConvertible

HBD asset to be converted.

required
base
HbdNaiAssetConvertible

HBD asset price base.

required
quote
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
@abstractmethod
def hbd_to_hive(
    self, hbd: HbdNaiAssetConvertible, base: HbdNaiAssetConvertible, quote: HiveNaiAssetConvertible
) -> NaiAsset:
    """
    Converts given HBD into HIVE, both in nai form.

    Args:
        hbd: HBD asset to be converted.
        base: HBD asset price base.
        quote: HIVE asset price quote.

    Returns:
        NaiAsset: asset converted asset into HIVE.

    Raises:
        UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset it is incorrect.
    """

hive_to_hbd abstractmethod

Converts given HIVE into HBD, both in nai form.

Parameters:

Name Type Description Default
hive
HiveNaiAssetConvertible

HIVE asset to be converted.

required
base
HbdNaiAssetConvertible

HBD asset price base.

required
quote
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
@abstractmethod
def hive_to_hbd(
    self, hive: HiveNaiAssetConvertible, base: HbdNaiAssetConvertible, quote: HiveNaiAssetConvertible
) -> NaiAsset:
    """
    Converts given HIVE into HBD, both in nai form.

    Args:
        hive: HIVE asset to be converted.
        base: HBD asset price base.
        quote: HIVE asset price quote.

    Returns:
        NaiAsset: converted asset into HBD.

    Raises:
        UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset is incorrect.
    """

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
account_name
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
@staticmethod
@abstractmethod
def is_valid_account_name(account_name: AccountName) -> bool:
    """
    Checks if the given account name is valid.

    Args:
        account_name: Account name to be checked.

    Returns:
        bool: True if the account name is valid, False otherwise.
    """

suggest_brain_key abstractmethod staticmethod

suggest_brain_key() -> IBrainKeyData

Returns brain key data.

Returns:

Name Type Description
BrainKeyData IBrainKeyData
  • brain key: a string containing space separated list of N words generated as a brain key (atm 16)
  • wif private key: first private key derived from above specified brain key
  • associated public key: base58 string pointing the public key associated to the private key
Source code in wax/interfaces.py
424
425
426
427
428
429
430
431
432
433
434
435
@staticmethod
@abstractmethod
def suggest_brain_key() -> IBrainKeyData:
    """
    Returns brain key data.

    Returns:
        BrainKeyData:
            * brain key: a string containing space separated list of N words generated as a brain key (atm 16)
            * wif private key: first private key derived from above specified brain key
            * associated public key: base58 string pointing the public key associated to the private key
    """

vests_to_hp abstractmethod

Converts given VESTS into HP, both in nai form.

Parameters:

Name Type Description Default
vests
VestsNaiAssetConvertible

VESTS asset.

required
total_vesting_fund_hive
HiveNaiAssetConvertible

HIVE asset total vesting fund.

required
total_vesting_shares
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
@abstractmethod
def vests_to_hp(
    self,
    vests: VestsNaiAssetConvertible,
    total_vesting_fund_hive: HiveNaiAssetConvertible,
    total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset:
    """
    Converts given VESTS into HP, both in nai form.

    Args:
        vests: VESTS asset.
        total_vesting_fund_hive: HIVE asset total vesting fund.
        total_vesting_shares: VESTS asset total vesting shares.

    Returns:
        NaiAsset: converted asset into HP (HIVE).

    Raises:
        CannotCreateAssetError/UnknownAssetTypeError/AssertionError: When passed asset is incorrect.
    """

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

chain_id

ChainId | str

chain id used for signing. Defaults to mainnet chain id.

DEFAULT_CHAIN_ID

endpoint_url

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
def __init__(
    self,
    chain_id: ChainId | str = DEFAULT_CHAIN_ID,
    endpoint_url: HttpUrl | str = DEFAULT_ENDPOINT_URL,
) -> None:
    """
    Constructs WaxChainOptions.

    Args:
        chain_id: chain id used for signing. Defaults to mainnet chain id.
        endpoint_url: url of the node to connect to. Defaults to mainnet (hive.blog) node.

    Raises:
        InvalidEndpointUrlFormatError: if endpoint_url is not valid.
    """
    super().__init__(chain_id)
    self._endpoint_url = convert_to_http_url(endpoint_url)

WaxOptions

WaxOptions(chain_id: ChainId = DEFAULT_CHAIN_ID)

Allows configuration of wax itself.

Constructs WaxOptions.

Parameters:

Name Type Description Default

chain_id

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
def __init__(self, chain_id: ChainId = DEFAULT_CHAIN_ID) -> None:
    """
    Constructs WaxOptions.

    Args:
        chain_id: chain id used for signing. Defaults to mainnet chain id.
    """
    self.chain_id = chain_id

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
def create_hive_chain(options: WaxChainOptions | None = None) -> IHiveChainInterface[ApiCollectionT | WaxApiCollection]:
    """Factory function to provide hive chain interface functionality."""
    options = options if options is not None else WaxChainOptions()
    chain_id = options.chain_id
    endpoint_url = options.endpoint_url

    return HiveChainApi(chain_id, endpoint_url, _private=True)

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
def create_wax_foundation(options: WaxOptions | None = None) -> IWaxBaseInterface:
    """Factory function to provide wax base interface functionality."""
    chain_id = options.chain_id if options is not None else WaxOptions().chain_id

    return WaxBaseApi(chain_id, _private=True)

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
def __init__(
    self,
    possible_categories: PossibleCategoriesByCategoryName,
    possible_roles: PossibleRoles,
    *,
    _private: bool = False,
) -> None:
    assert (
        _private
    ), "AccountAuthorityUpdateOperation should be created only by AccountAuthorityUpdateOperation.create_for"
    super().__init__()
    self._possible_categories: PossibleCategoriesByCategoryName = possible_categories
    self._possible_roles: PossibleRoles = possible_roles
categories property

Get category to modify.

roles property

Get role to modify.

Typical usage example

account_update_operation.roles.active.any_action()

create_for async staticmethod

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
@staticmethod
async def create_for(
    chain: IHiveChainInterface[ApiCollectionT], account: AccountName
) -> AccountAuthorityUpdateOperation:
    """
    Factory method for creating AccountAuthorityUpdateOperation.

    Args:
        chain (IHiveChainInterface): instance of IHiveChainInterface.
        account (AccountName): account name to update authority.

    Returns:
        AccountAuthorityUpdateOperation instance.
    """
    role_per_role_name: dict[str, LevelBase[Any]] = {}
    category_per_category_name: dict[str, RoleCategoryBase[Any]] = {}

    for category in AuthorityRoleCategories:
        container = category()
        category_per_category_name[container.category] = container

    for category_instance in category_per_category_name.values():
        await category_instance.init(chain, account)

        for role_name, role_instance in category_instance.authorities.__dict__.items():
            role_per_role_name[role_name] = role_instance  # noqa: PERF403

    return AccountAuthorityUpdateOperation(
        PossibleCategoriesByCategoryName(**category_per_category_name),  # type: ignore[arg-type]
        PossibleRoles(**role_per_role_name),  # type: ignore[arg-type]
        _private=True,
    )
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
def finalize(self, api: IWaxBaseInterface) -> Iterable[ConvertedToProtoOperation]:
    """
    Finalize updating account authority.

    Args:
        api (IWaxBaseInterface): Wax api subclass instance.

    Returns:
        Iterable[ConvertedToProtoOperation]: List of operations.

    Raises:
        NoAuthorityOperationGeneratedError: If no operation was generated.
    """
    operations: list[ConvertedToProtoOperation] = [
        operation for category in asdict(self.categories).values() for operation in category.finalize(api)
    ]

    if not operations:
        raise NoAuthorityOperationGeneratedError

    return operations
PossibleCategoriesByCategoryName dataclass
PossibleCategoriesByCategoryName(hive: HiveAccountCategory)

All of possible categories grouped by name. Add new categories also here.

PossibleRoles dataclass

Bases: HiveRoles

All of possible roles. Add new roles to as base classes.

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.

Source code in wax/complex_operations/role_classes/hive_authority/hive_account_category.py
57
58
59
60
61
def __init__(self) -> None:
    super().__init__()
    self._account: AccountName | NotYetInitialized = NotYetInitialized()
    self._HIVE_MAX_AUTHORITY_MEMBERSHIP: int | NotYetInitialized = NotYetInitialized()
    self._authorities: HiveRoles | NotYetInitialized = NotYetInitialized()
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
async def init(self, chain: IHiveChainInterface[ApiCollectionT], account: AccountName) -> None:
    """
    Initializes the hive account category.

    Function retrieves all necessary authorities from the chain and initializes them.

    Raises:
        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.
    """

    def transform_entries(entry: list[tuple[AccountName | PublicKey, int]]) -> dict[PublicKey | AccountName, int]:
        return {entry[0]: entry[1] for entry in entry}

    def raise_cannot_update_owner_error() -> None:
        raise WaxError("Owner authority cannot be updated due to owner authority update limit - twice an hour")

    def check_owner_time_diff(time: datetime) -> bool:
        return datetime.now(tz=timezone.utc) - time > timedelta(
            seconds=int(self._ensure_chain_config_reachable(chain.config.get("HIVE_OWNER_UPDATE_LIMIT")))
            / 1_000_000
        )

    if chain.config.get("HIVE_TEMP_ACCOUNT") == account:
        raise HiveTempAccountUsedError

    self._account = account
    self._HIVE_MAX_AUTHORITY_MEMBERSHIP = int(
        self._ensure_chain_config_reachable(chain.config.get("HIVE_MAX_AUTHORITY_MEMBERSHIP"))
    )

    api_accounts = await chain.api.database_api.find_accounts(accounts=[account])  # type: ignore[attr-defined]

    searched_account = None

    for api_account in api_accounts.accounts:
        if api_account.name == account:
            searched_account = api_account
            break

    if searched_account is None:
        raise AccountNotFoundError(f"Account {account} not found on the chain")

    active, posting, owner, memo_key = (
        searched_account.active,
        searched_account.posting,
        searched_account.owner,
        searched_account.memo_key,
    )

    max_account_name_length = int(
        self._ensure_chain_config_reachable(chain.config.get("HIVE_MAX_ACCOUNT_NAME_LENGTH"))
    )
    address_prefix = self._ensure_chain_config_reachable(chain.config.get("HIVE_ADDRESS_PREFIX"))

    self._authorities = HiveRoles(
        active=HiveRoleAuthorityDefinition("active"),
        owner=HiveRoleAuthorityDefinition(
            "owner",
            lambda role: raise_cannot_update_owner_error()  # noqa: ARG005
            if not check_owner_time_diff(searched_account.last_owner_update)
            and check_owner_time_diff(searched_account.previous_owner_update)
            else None,
        ),
        posting=HiveRoleAuthorityDefinition("posting"),
        memo=HiveRoleMemoKeyDefinition(),
    )

    self._authorities.active.init(
        max_account_name_length,
        address_prefix,
        proto_authority(
            weight_threshold=active.weight_threshold,
            account_auths=transform_entries(active.account_auths),
            key_auths=transform_entries(active.key_auths),
        ),
    )

    self._authorities.owner.init(
        max_account_name_length,
        address_prefix,
        proto_authority(
            weight_threshold=owner.weight_threshold,
            account_auths=transform_entries(owner.account_auths),
            key_auths=transform_entries(owner.key_auths),
        ),
    )

    self._authorities.posting.init(
        max_account_name_length,
        address_prefix,
        proto_authority(
            weight_threshold=posting.weight_threshold,
            account_auths=transform_entries(posting.account_auths),
            key_auths=transform_entries(posting.key_auths),
        ),
    )

    self._authorities.memo.init(
        address_prefix,
        memo_key,
    )
hive_role_authority_definition
HiveRoleAuthorityDefinition
HiveRoleAuthorityDefinition(
    level: TRole,
    ensure_can_update: Callable[
        [TRole], None
    ] = lambda level: None,
)

Bases: LevelBase[TRole]

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
def __init__(
    self,
    level: TRole,
    ensure_can_update: Callable[[TRole], None] = lambda level: None,  # noqa: ARG005
) -> None:
    super().__init__(level)
    self.ensure_can_update = ensure_can_update

    self._HIVE_MAX_ACCOUNT_NAME_LENGTH: int | NotYetInitialized = NotYetInitialized()
    self._HIVE_ADDRESS_PREFIX: str | NotYetInitialized = NotYetInitialized()
    self._authority: WaxAuthority | NotYetInitialized = NotYetInitialized()
    self._previous_authority: WaxAuthority | NotYetInitialized = NotYetInitialized()
changed property
changed: bool

Checks if the authority has changed since the last update.

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
def add(self, 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.

    Args:
        account_or_key: Account or key to be added to the currently selected role.
        weight: Account or key weight in the authority. Default is 1.

    Returns:
        Self: itself.

    Raises:
        InvalidAccountOrKeyError: If the account or key is invalid.
    """
    self.ensure_can_update(self.level)
    self._add_to_role(account_or_key, weight)
    return self
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
def clear(self) -> Self:
    """Clears the currently selected role."""
    self.ensure_can_update(self.level)

    self.authority.key_auths.clear()
    self.authority.account_auths.clear()
    self.authority.weight_threshold = DEFAULT_ACCOUNT_OR_KEY_WEIGHT

    return self
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
def has(self, account_or_key: PublicKey | AccountName, weight: int | None = None) -> bool:
    """
    Checks if the account or key is present in the currently selected role.

    Args:
        account_or_key: Account or key to be checked.
        weight: Account or key weight in the authority. If provided - is checked as well.

    Returns:
        bool: True if the account or key is present in the currently selected role.
    """
    as_tuple = self._get_tuple(account_or_key)

    if weight and as_tuple:
        return as_tuple[1] == weight
    return bool(as_tuple)
remove

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
def remove(self, account_or_key: PublicKey | AccountName) -> Self:
    """
    Remove given account or key from the currently selected role.

    Args:
        account_or_key: Account or key to be removed from the currently selected role.

    Returns:
        Self: itself.

    Raises:
        InvalidAccountOrKeyError: If the account or key is invalid.
    """
    self.ensure_can_update(self.level)
    self._remove_from_role(account_or_key)
    return self
replace

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
def replace(
    self,
    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.

    Args:
        account_or_key: Account or key to be replaced.
        weight: Account or key weight.
        new_account_or_key: New account or key to replace the old one. If not provided,
                            the account or key is not replaced, but weight is changed.

    Returns:
        Self: itself.

    Raises:
        InvalidAccountOrKeyError: If the account or key is invalid.
    """
    self.ensure_can_update(self.level)

    if new_account_or_key is None:
        new_account_or_key = account_or_key

    if account_or_key != new_account_or_key:
        self._ensure_valid_account_or_key(new_account_or_key)
        self._remove_from_role(account_or_key)

    self._add_to_role(new_account_or_key, weight)
    return self
set_threshold
set_threshold(
    threshold: int = DEFAULT_ACCOUNT_OR_KEY_WEIGHT,
) -> Self

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
def set_threshold(self, threshold: int = DEFAULT_ACCOUNT_OR_KEY_WEIGHT) -> Self:
    """
    Set the weight threshold for the currently selected role.

    Args:
        threshold: Weight threshold for the currently selected role.

    Returns:
        Self: itself.

    Raises:
        AssertionError: If the role is not initialized.

    """
    self.ensure_can_update(self.level)
    self.authority.weight_threshold = threshold
    return self
hive_role_memo_key
MemoKeyRoleName module-attribute
MemoKeyRoleName = Literal['memo']

Memo key role name.

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
def __init__(self) -> None:
    super().__init__("memo")
    self._HIVE_ADDRESS_PREFIX: str | NotYetInitialized = NotYetInitialized()

    self._public_key: PublicKey | NotYetInitialized = NotYetInitialized()
    self._previous_public_key: PublicKey | NotYetInitialized = NotYetInitialized()
changed property
changed: bool

Checks if the key has changed since the last update.

is_set property
is_set: bool

Check if the memo key is set to the default value - null public key.

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
def set(self, public_key: PublicKey) -> Self:
    """
    Sets the provided public key as the account memo key.

    Args:
        public_key (PublicKey): Public key to set.

    Returns:
        Self: Role instance.

    Raises:
        InvalidMemoKeyError: If the provided public key is invalid.
    """
    if not self._is_public_key_valid(public_key):
        raise InvalidMemoKeyError(public_key)

    self._public_key = public_key
    return self
hive_roles
ActiveRoleName module-attribute
ActiveRoleName = Literal['active']

Active role name.

OwnerRoleName module-attribute
OwnerRoleName = Literal['owner']

Owner role name.

PostingRoleName module-attribute
PostingRoleName = Literal['posting']

Posting role name.

HiveRoles dataclass

Currently available roles in the hive account category.

level_base
TRole module-attribute
TRole = TypeVar(
    "TRole",
    bound=Literal["memo", "active", "owner", "posting"],
)

Type variable for role names.

LevelBase
LevelBase(level: TRole)

Bases: ABC, Generic[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
def __init__(self, level: TRole) -> None:
    self._level = level
changed abstractmethod property
changed: bool

Indicates if the level has changed since the last update.

level property
level: TRole

Role level name. Should be unique.

value abstractmethod property
value: Any

Returns the value of the level.

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
@abstractmethod
def reset(self) -> None:
    """Resets the level to the initial state."""
role_category_base
AuthType module-attribute
AuthType = TypeVar('AuthType')

Type variable for the authority type.

RoleCategoryBase

Bases: ABC, Generic[AuthType]

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.

category abstractmethod property
category: str

Category name. Should be unique.

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
@abstractmethod
def finalize(self, api: IWaxBaseInterface) -> Iterable[ConvertedToProtoOperation]:
    """
    Function should return iterable object of operations that will modify the user accounts roles.

    Args:
        api (IWaxBaseInterface): Instance of the wax base api subclass.
    """
init abstractmethod async

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
@abstractmethod
async def init(self, chain: IHiveChainInterface[ApiCollectionT], account: AccountName) -> None:
    """
    Responsible for gathering authority types for the given account.

    Args:
        chain (IHiveChainInterface): Wax chain api instance.
        account (AccountName): Account name to gather authority from the given chain.
    """

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
def __init__(self, account: AccountName) -> None:
    self.account = account
    self.message = f"Account '{account}' not found."
    super().__init__(self.message)

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
def __init__(self, authority_level: str) -> None:
    self.message = f"{authority_level} authority cannot be satisfied due to insufficient weight"
    self.authority_level = authority_level
    super().__init__(self.message)

DecimalConversionError

Bases: WaxError

Base exception for all decimal 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
def __init__(self, precision: int) -> None:
    self.precision = precision
    self.message = f"Precision must be a positive integer. Given: {precision}"
    super().__init__(self.message)

DecimalConversionNotANumberError

Bases: DecimalConversionError

Raised when decimal conversion fails because the value is not a number.

HiveAccountCategoryError

Bases: WaxError

Base class for HiveAccountCategory errors.

HiveMaxAuthorityMembershipExceededError

HiveMaxAuthorityMembershipExceededError(
    max_membership: int, current_membership: int
)

Bases: HiveAccountCategoryError

Raised when the authority membership exceeds the maximum.

Source code in wax/exceptions/chain_errors.py
35
36
37
38
39
def __init__(self, max_membership: int, current_membership: int) -> None:
    self.message = f"Authority membership exceeds. Max: {max_membership}, current: {current_membership}"
    self.max_membership = max_membership
    self.current_membership = current_membership
    super().__init__(self.message)

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
def __init__(self) -> None:
    self.message = "Cannot edit temporary account in hive category"
    super().__init__(self.message)

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
def __init__(self, account: AccountName) -> None:
    self.account = account
    self.message = f"Account name '{account}' is invalid."
    super().__init__(self.message)

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
def __init__(self, account_or_key: str) -> None:
    self.account_or_key = account_or_key
    self.message = f"Account or key '{account_or_key}' is invalid."
    super().__init__(self.message)

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
def __init__(self, memo_key: PublicKey) -> None:
    self.memo_key = memo_key
    self.message = f"Invalid memo key: {memo_key} provided."
    super().__init__(self.message)

InvalidOperationFormatError

Bases: WaxError

Raised when operation is in invalid format.

WaxError

Bases: Exception

Base exception for all wax operations.

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
def __init__(self) -> None:
    super().__init__(
        "You must compile the proto files before importing them." "Using `build_wax..sh` script is recommended."
    )

WaxValidationFailedError

WaxValidationFailedError(reason: str)

Bases: WaxError

Raises when validation using wax failed.

Source code in wax/exceptions/validation_errors.py
15
16
17
18
def __init__(self, reason: str) -> None:
    self.reason = reason
    self.message = f"Validation using wax failed due to: {reason}"
    super().__init__(self.message)

asset_errors

AssetError

Bases: WaxError

Base error for the asset-related exceptions.

For more detailed exceptions, see the subclasses.

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
def __init__(self, account: AccountName) -> None:
    self.account = account
    self.message = f"Account '{account}' not found."
    super().__init__(self.message)
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
def __init__(self, authority_level: str) -> None:
    self.message = f"{authority_level} authority cannot be satisfied due to insufficient weight"
    self.authority_level = authority_level
    super().__init__(self.message)
HiveAccountCategoryError

Bases: WaxError

Base class for HiveAccountCategory errors.

HiveMaxAuthorityMembershipExceededError
HiveMaxAuthorityMembershipExceededError(
    max_membership: int, current_membership: int
)

Bases: HiveAccountCategoryError

Raised when the authority membership exceeds the maximum.

Source code in wax/exceptions/chain_errors.py
35
36
37
38
39
def __init__(self, max_membership: int, current_membership: int) -> None:
    self.message = f"Authority membership exceeds. Max: {max_membership}, current: {current_membership}"
    self.max_membership = max_membership
    self.current_membership = current_membership
    super().__init__(self.message)
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
def __init__(self) -> None:
    self.message = "Cannot edit temporary account in hive category"
    super().__init__(self.message)

conversion_errors

DecimalConversionError

Bases: WaxError

Base exception for all decimal 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
def __init__(self, precision: int) -> None:
    self.precision = precision
    self.message = f"Precision must be a positive integer. Given: {precision}"
    super().__init__(self.message)
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
def __init__(self, account: AccountName) -> None:
    self.account = account
    self.message = f"Account name '{account}' is invalid."
    super().__init__(self.message)
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
def __init__(self, account_or_key: str) -> None:
    self.account_or_key = account_or_key
    self.message = f"Account or key '{account_or_key}' is invalid."
    super().__init__(self.message)
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
def __init__(self, url: HttpUrl | str) -> None:
    self.url = url
    self.message = f"Endpoint url '{url}' is in invalid format."
    super().__init__(self.message)
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
def __init__(self, memo_key: PublicKey) -> None:
    self.memo_key = memo_key
    self.message = f"Invalid memo key: {memo_key} provided."
    super().__init__(self.message)
InvalidOperationFormatError

Bases: WaxError

Raised when operation is in invalid format.

NoAuthorityOperationGeneratedError
NoAuthorityOperationGeneratedError()

Bases: WaxError

Raised when no operations are generated.

Source code in wax/exceptions/validation_errors.py
69
70
71
def __init__(self) -> None:
    self.message = "No operations updating account authority generated."
    super().__init__(self.message)
WaxValidationFailedError
WaxValidationFailedError(reason: str)

Bases: WaxError

Raises when validation using wax failed.

Source code in wax/exceptions/validation_errors.py
15
16
17
18
def __init__(self, reason: str) -> None:
    self.reason = reason
    self.message = f"Validation using wax failed due to: {reason}"
    super().__init__(self.message)

wax_error

WaxError

Bases: Exception

Base exception for all wax operations.

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
def __init__(self) -> None:
    super().__init__(
        "You must compile the proto files before importing them." "Using `build_wax..sh` script is recommended."
    )

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
offset
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'
speed_up_rate
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
speed_up_rate
float | int | None

An speed-up rate Format: positive floating-point number. (e.g. "10.0")

None

Raises:

Type Description
ValueError

if speed_up_rate has an incorrect format.

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
start_time
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()
speed_up_rate
float | int | None

An speed-up rate Format: positive floating-point number. (e.g. "10.0")

None

Raises:

Type Description
ValueError

if start_time has an incorrect format, if speed_up_rate has an incorrect format.

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
predicate
Callable[[], bool] | Callable[[], Awaitable[bool]]

Callable that returns boolean value.

required
timeout
float | timedelta

Timeout in seconds or preferably timedelta.

inf
timeout_error_message
str | None

Message that will be displayed if timeout is reached.

None
poll_time
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
@classmethod
async def async_wait_for(
    cls,
    predicate: Callable[[], bool] | Callable[[], Awaitable[bool]],
    *,
    timeout: float | timedelta = math.inf,
    timeout_error_message: str | None = None,
    poll_time: float = 1.0,
) -> float:
    """
    Waits asynchronously for the predicate to return True.

    Args:
        predicate: Callable that returns boolean value.
        timeout: Timeout in seconds or preferably timedelta.
        timeout_error_message: Message that will be displayed if timeout is reached.
        poll_time: Time between predicate calls.

    Raises:
        TimeoutError: if given timeout exceeds

    Returns:
        Time it took to wait for predicate return True.
    """
    timeout_secs = cls.__calculate_timeout_secs_and_validate_it(timeout=timeout)
    already_waited = 0.0

    async def __run_asynchronously_predicate() -> bool:
        result = predicate()
        if isinstance(result, bool):
            return result
        return await result

    while not await __run_asynchronously_predicate():
        cls.__check_is_timeout_exceeded(
            timeout_secs=timeout_secs, already_waited=already_waited, timeout_error_message=timeout_error_message
        )

        sleep_time = min(poll_time, timeout_secs)
        await asyncio.sleep(sleep_time)
        already_waited += sleep_time

    return already_waited
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
milliseconds
int

milliseconds to add.

0
seconds
int

seconds to add.

0
minutes
int

minutes to add.

0
hours
int

hours to add.

0
days
int

days to add.

0
weeks
int

weeks to add.

0
months
int

months to add.

0
years
int

years to add.

0
time_zone
timezone | None

time zone to set.

utc
serialize
bool

return serialized time or as datetime.

True
serialize_format
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
@classmethod
def from_now(  # noqa: PLR0913 # it is mirroring timedelta interface
    cls,
    *,
    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 = timezone.utc,
    serialize: bool = True,
    serialize_format: TimeFormats | str = TimeFormats.DEFAULT_FORMAT,
) -> str | datetime:
    """
    Adds to current time given time periods.

    Args:
        milliseconds: milliseconds to add.
        seconds: seconds to add.
        minutes: minutes to add.
        hours: hours to add.
        days: days to add.
        weeks: weeks to add.
        months: months to add.
        years: years to add.
        time_zone: time zone to set.
        serialize: return serialized time or as datetime.
        serialize_format: if serialize, this determines format.

    Raises:
        ValueError: no periods has been given

    Returns:
        serialized or as datetime, shifted time with given time periods.
    """
    if not any([milliseconds, seconds, minutes, hours, days, weeks, months, years]):
        raise ValueError(
            "At least one keyword argument is required.\n"
            "If you want to get the current datetime, please use `Time.now()` instead."
        )

    delta = relativedelta(
        microseconds=milliseconds * 10**3,
        seconds=seconds,
        minutes=minutes,
        hours=hours,
        days=days,
        weeks=weeks,
        months=months,
        years=years,
    )

    now = cls.now(time_zone=time_zone, serialize=False)
    assert isinstance(now, datetime)  # just because of mypy
    time = now + delta
    return cls.serialize(time, format_=serialize_format) if serialize else time
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
time
str

time string to parse

required
format_
TimeFormats | str | None

format of given time string

None
time_zone
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
@classmethod
def parse(
    cls,
    time: str,
    *,
    format_: TimeFormats | str | None = None,
    time_zone: timezone | None = timezone.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.

    Args:
        time: time string to parse
        format_: format of given time string
        time_zone: timezone to set after parsing

    Raises:
        ParseError: if parsing is not possible

    Returns:
        datetime.datetime object
    """
    if isinstance(time, datetime):
        return time

    def __parse_in_specified_format(_format: TimeFormats | str) -> datetime:
        if isinstance(_format, str):
            _format = TimeFormats(_format)
        try:
            parsed = datetime.strptime(time, _format.value)  # noqa: DTZ007 # in hive project %z is unused because all timestamps are utc
            return parsed.replace(tzinfo=time_zone) if time_zone else parsed
        except ValueError as exception:
            format_info = (
                f"`{_format}` custom format."
                if _format not in (TimeFormats.DEFAULT_FORMAT_WITH_MILLIS, TimeFormats.DEFAULT_FORMAT)
                else (
                    f"`{TimeFormats.DEFAULT_FORMAT}` or `{TimeFormats.DEFAULT_FORMAT_WITH_MILLIS}` default formats."
                )
            )
            raise ParseError(f"Could not be parse the `{time}` string using the {format_info}") from exception

    if format_ is not None:
        return __parse_in_specified_format(format_)

    try:
        return __parse_in_specified_format(TimeFormats.DEFAULT_FORMAT)
    except ParseError:
        return __parse_in_specified_format(TimeFormats.DEFAULT_FORMAT_WITH_MILLIS)
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
predicate
Callable[[], bool]

Callable that returns boolean value.

required
timeout
float | timedelta

Timeout in seconds or preferably timedelta.

inf
timeout_error_message
str | None

Message that will be displayed if timeout is reached.

None
poll_time
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
@classmethod
def sync_wait_for(
    cls,
    predicate: Callable[[], bool],
    *,
    timeout: float | timedelta = math.inf,
    timeout_error_message: str | None = None,
    poll_time: float = 1.0,
) -> float:
    """
    Waits synchronously for the predicate to return True.

    Args:
        predicate: Callable that returns boolean value.
        timeout: Timeout in seconds or preferably timedelta.
        timeout_error_message: Message that will be displayed if timeout is reached.
        poll_time: Time between predicate calls.

    Raises:
        TimeoutError: if given timeout exceeds

    Returns:
        Time it took to wait for predicate return True.
    """
    timeout_secs = cls.__calculate_timeout_secs_and_validate_it(timeout=timeout)
    already_waited = 0.0
    while not predicate():
        if timeout_secs - already_waited <= 0:
            raise TimeoutError(timeout_error_message or "Waited too long, timeout was reached")

        sleep_time = min(poll_time, timeout_secs)
        time.sleep(sleep_time)
        already_waited += sleep_time

    return already_waited
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
predicate
Callable[[], bool]

Callable that returns boolean value.

required
timeout
float | timedelta

Timeout in seconds or preferably timedelta (e.g. tt.Time.minutes(1)).

inf
timeout_error_message
str | None

Message that will be displayed if timeout is reached.

None
poll_time
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
@staticmethod
def wait_for(
    predicate: Callable[[], bool],
    *,
    timeout: float | timedelta = math.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.

    Args:
        predicate: Callable that returns boolean value.
        timeout: Timeout in seconds or preferably timedelta (e.g. tt.Time.minutes(1)).
        timeout_error_message: Message that will be displayed if timeout is reached.
        poll_time: Time between predicate calls.

    Returns:
        Time in seconds that was spent on waiting.
    """
    timeout_secs: float = timeout.total_seconds() if isinstance(timeout, timedelta) else timeout
    assert timeout_secs >= 0, "The `timeout` argument must be non-negative value."

    already_waited = 0.0
    while not predicate():
        if timeout_secs - already_waited <= 0:
            raise TimeoutError(timeout_error_message or "Waited too long, timeout was reached")

        sleep_time = min(poll_time, timeout_secs)
        time.sleep(sleep_time)
        already_waited += sleep_time

    return already_waited

exceptions

BlockWaitTimeoutError

Bases: HelpyError

Raised if reached not expected block number.

Creates exception.

Parameters:

Name Type Description Default
last_block_number
int

last fetched block number

required
block_number
int

block that was expected to be irreversible

required
last_irreversible_block_number
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
def __init__(
    self,
    last_block_number: int,
    block_number: int,
    last_irreversible_block_number: int,
) -> None:
    """
    Creates exception.

    Args:
        last_block_number: last fetched block number
        block_number: block that was expected to be irreversible
        last_irreversible_block_number: last fetched irreversible block number
    """
    super().__init__(
        f"Block with number `{last_block_number}` was just reached but expected `{block_number}` is still not"
        " irreversible.\n"
        f"Last irreversible block number is `{last_irreversible_block_number}`."
    )
HelpyError

Bases: Exception

Base class for all helpy Errors.

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: TypeAlias = dict[str, str]

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

JsonTransaction: TypeAlias = str

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: TypeAlias = datetime | timedelta

TTimestamp is a type alias for a timestamp that can be either a datetime object or a timedelta object.

IHiveChainInterface

Bases: IWaxBaseInterface, Generic[ApiCollectionT]

api abstractmethod property

Returns the API collection object.

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
transaction
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
@abstractmethod
async def broadcast(self, transaction: ITransaction | IOnlineTransaction) -> None:
    """
    Broadcast transaction to the selected during Wax Chain initialization Hive Node.

    Args:
        transaction: Transaction object to be broadcasted.

    Raises:
        TransactionNotSignedError: When the transaction is not signed.
        WaxValidationFailedError: When the transaction is incorrect.
    """
collect_account_authorities abstractmethod async
collect_account_authorities(
    account: AccountName,
) -> WaxAccountAuthorityInfo

Collects account authorities.

Parameters:

Name Type Description Default
account
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
@abstractmethod
async def collect_account_authorities(self, account: AccountName) -> WaxAccountAuthorityInfo:
    """
    Collects account authorities.

    Args:
        account: Account name.

    Returns:
        WaxAccountAuthorityInfo: Account authority info.

    Raises:
        InvalidAccountNameError: When the account name is invalid.
        AccountNotFoundError: When the account is not found in the HIVE api node.
    """
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
expiration
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
@abstractmethod
async def create_transaction(self, expiration: TTimestamp | None = None) -> IOnlineTransaction:
    """
    Same as `IWaxBaseInterface.create_transaction_with_tapos` but pulls the reference block data from the remote.

    Args:
        expiration: time (UTC) till transaction is valid. Default to +1 minute.

    Returns:
        Transaction object

    Raises:
        AssertionError: when expiration is not valid type.
    """
extends abstractmethod

Extends the current API collection with a new one.

Parameters:

Name Type Description Default
new_api
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
@abstractmethod
def extends(
    self, new_api: type[ExtendedApiCollectionT]
) -> IHiveChainInterface[ExtendedApiCollectionT | ApiCollectionT]:
    """
    Extends the current API collection with a new one.

    Args:
        new_api: New API collection class to be added.

    Returns:
        IHiveChainInterface: 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
    """

IManabarData dataclass

IManabarData(max_mana: int, current_mana: int)

Bases: ABC

Manabar data contains: max mana, current mana and percent.

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
operation
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
@abstractmethod
def push_operation(self, operation: WaxMetaOperation) -> Self:
    """
    Pushes given operation into the transaction (exactly to the list of operations).

    Args:
        operation: Operation to be pushed into the transaction in dict or proto format.

    Examples:
        * Proto format:
        transaction.push_operation(vote_pb2.vote(voter="alice", author="bob", permlink="/", weight=11))

    Returns:
        Self: current transaction instance.
    """

ITransactionBase

Bases: ABC

id abstractmethod property

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
signature_keys: list[PublicKey]

Returns signature keys from the transaction signatures (HF26 serialization used).

Returns:

Type Description
list[PublicKey]

list[PublicKey]: List of public keys used to sign the transaction.

Raises:

Type Description
WaxValidationFailedError

When the transaction is incorrect.

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
add_signature(signature: Signature) -> Signature

Adds your signature to the internal signatures list inside underlying transaction.

Parameters:

Name Type Description Default
signature
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
@abstractmethod
def add_signature(self, signature: Signature) -> Signature:
    """
    Adds your signature to the internal signatures list inside underlying transaction.

    Args:
        signature: Signature to be added.

    Returns:
        Signature: Added transaction signature.
    """
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
wallet
AsyncUnlockedWallet

Unlocked wallet to be used for signing.

required
public_key
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
@abstractmethod
async def sign(self, wallet: AsyncUnlockedWallet, public_key: PublicKey) -> Signature:
    """
    Signs asynchronously the transaction using given public key. Applies the transaction expiration time.

    Args:
        wallet: Unlocked wallet to be used for signing.
        public_key: Public key for signing (remember that should be available in the wallet!)

    Returns:
        Signature: Transaction signature signed using given key.

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """
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
@abstractmethod
def to_api(self) -> str:
    """
    Converts the created transaction into the Hive API-form str.

    Returns:
        str: Transaction in Hive API-form.

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """
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
@abstractmethod
def to_api_json(self) -> JsonTransaction:
    """
    Converts the created transaction into the Hive API-form JSON.

    Returns:
        JsonTransaction: Transaction in Hive API-form.

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """
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
@abstractmethod
def to_binary_form(self) -> Hex:
    """
    Allows to serialize underlying transaction to HF26 specific binary form, then return it as hexstring.

    Returns:
        Hex: Serialized transaction in hex form.
    """
to_dict abstractmethod
to_dict() -> dict[str, Any]

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
@abstractmethod
def to_dict(self) -> dict[str, Any]:
    """
    Converts the created transaction into the Hive API-form dict.

    Returns:
        dict: Transaction in Hive API-form.

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """
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
@abstractmethod
def to_string(self) -> str:
    """
    Converts transaction object into the protobuf JSON string.

    Returns:
        str: Protobuf JSON string.

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """
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
@abstractmethod
def validate(self) -> None:
    """
    Validates current transaction.

    Returns:
        None

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """

IWaxBaseInterface

Bases: ABC

address_prefix abstractmethod property
address_prefix: str

Returns the public key address prefix.

chain_id abstractmethod property
chain_id: ChainId

Returns the chain id.

config abstractmethod property
config: ChainConfig

Returns protocol configuration for the current chain.

hbd abstractmethod property

Returns set of methods to create HBD asset.

hive abstractmethod property

Returns set of methods to create HIVE asset.

vests abstractmethod property
vests: AssetFactory

Returns set of methods to create VESTS asset.

calculate_account_hp abstractmethod

Calculates account HP based on given vests, total vesting fund HIVE and total vesting shares.

Parameters:

Name Type Description Default
vests
VestsNaiAssetConvertible

VESTS asset.

required
total_vesting_fund_hive
HiveNaiAssetConvertible

HIVE asset total vesting fund.

required
total_vesting_shares
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
@abstractmethod
def calculate_account_hp(
    self,
    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.

    Args:
        vests: VESTS asset.
        total_vesting_fund_hive: HIVE asset total vesting fund.
        total_vesting_shares: VESTS asset total vesting shares.

    Returns:
        NaiAsset: calculated HP for the given vests, total vesting fund HIVE and total vesting shares.

    Raises:
        UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset is incorrect.
    """
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
head_block_time
datetime

Head block time. Can be obtained using time property from dgpo (dynamic global properties)

required
max_mana
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
current_mana
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
last_update_time
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
@staticmethod
@abstractmethod
def calculate_current_manabar_value(
    head_block_time: datetime, max_mana: int, current_mana: int, last_update_time: int
) -> IManabarData:
    """
    Calculates of the current manabar.

    Args:
        head_block_time:
            Head block time. Can be obtained using time property from dgpo (dynamic global properties)
        max_mana:
            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.
        current_mana:
            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
        last_update_time:
            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.

    Returns:
        IManabarData: Calculated manabar value.

    Raises:
        WaxValidationFailedError: When passed parameters are wrong.
    """
calculate_hp_apr abstractmethod

Calculates HP APR.

Parameters:

Name Type Description Default
head_block_num
int

Head block number.

required
vesting_reward_percent
int

Vesting reward percent.

required
virtual_supply
HiveNaiAssetConvertible

Virtual supply.

required
total_vesting_fund_hive
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
@abstractmethod
def calculate_hp_apr(
    self,
    head_block_num: int,
    vesting_reward_percent: int,
    virtual_supply: HiveNaiAssetConvertible,
    total_vesting_fund_hive: HiveNaiAssetConvertible,
) -> Decimal:
    """
    Calculates HP APR.

    Args:
        head_block_num: Head block number.
        vesting_reward_percent: Vesting reward percent.
        virtual_supply: Virtual supply.
        total_vesting_fund_hive: Total vesting fund HIVE.

    Returns:
        Decimal: HP APR percent with 2 decimals

    Raises:
        WaxValidationFailedError: When passed parameters are wrong.
    """
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
head_block_time
datetime

Head block time. Can be obtained using time property from dgpo (dynamic global properties)

required
max_mana
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
current_mana
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
last_update_time
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
@staticmethod
@abstractmethod
def 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.

    Args:
        head_block_time:
            Head block time. Can be obtained using time property from dgpo (dynamic global properties)
        max_mana:
            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.
        current_mana:
            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
        last_update_time:
            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.

    Returns:
        datetime: Calculated manabar full regeneration time.

    Raises:
        WaxValidationFailedError: when passed parameters are wrong.
    """
calculate_witness_votes_hp abstractmethod

Calculates witness votes HP based on given votes, total vesting fund HIVE and total vesting shares.

Parameters:

Name Type Description Default
number
int

witness votes.

required
total_vesting_fund_hive
HiveNaiAssetConvertible

HIVE asset total vesting fund.

required
total_vesting_shares
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
@abstractmethod
def calculate_witness_votes_hp(
    self,
    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.

    Args:
        number: witness votes.
        total_vesting_fund_hive: HIVE asset total vesting fund.
        total_vesting_shares: VESTS asset total vesting shares.

    Returns:
        NaiAsset: Calculated votes in nai asset form.

    Raises:
         UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset is incorrect.
    """
create_transaction_from_json abstractmethod
create_transaction_from_json(
    transaction: JsonTransaction,
) -> ITransaction

Creates transaction object from JSON transaction.

Parameters:

Name Type Description Default
transaction
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
@abstractmethod
def create_transaction_from_json(self, transaction: JsonTransaction) -> ITransaction:
    """
    Creates transaction object from JSON transaction.

    Args:
        transaction: JSON transaction object.

    Returns:
        Transaction object

    Raises:
        WaxValidationFailedError: When the transaction is incorrect.
    """
create_transaction_from_proto abstractmethod
create_transaction_from_proto(
    transaction: ProtoTransaction,
) -> ITransaction

Creates transaction object from proto transaction.

Parameters:

Name Type Description Default
transaction
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
@abstractmethod
def create_transaction_from_proto(self, transaction: ProtoTransaction) -> ITransaction:
    """
    Creates transaction object from proto transaction.

    Args:
        transaction: Proto transaction object.

    Returns:
        Transaction object
    """
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
tapos_block_id
str

Block id (mostly head) that transaction should refer to

required
expiration
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
@abstractmethod
def create_transaction_with_tapos(self, tapos_block_id: str, expiration: TTimestamp | None = None) -> ITransaction:
    """
    Creates transaction object using basic information from chain.

    Args:
        tapos_block_id: Block id (mostly head) that transaction should refer to
        expiration: time (UTC) till transaction is valid. Default to +1 minute.

    Returns:
        Transaction object
    """
estimate_hive_collateral abstractmethod

Estimate hive collateral.

Parameters:

Name Type Description Default
current_median_history_base
HbdNaiAssetConvertible

Base for Current median price retrieved by get_feed_history

required
current_median_history_quote
HiveNaiAssetConvertible

Quote for Current median price retrieved by get_feed_history

required
current_min_history_base
HbdNaiAssetConvertible

Base for Current minimal price retrieved by get_feed_history

required
current_min_history_quote
HiveNaiAssetConvertible

Quote for Current minimal price retrieved by get_feed_history

required
hbd_amount_to_get
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
@abstractmethod
def estimate_hive_collateral(
    self,
    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.

    Args:
        current_median_history_base: Base for Current median price retrieved by `get_feed_history`
        current_median_history_quote: Quote for Current median price retrieved by `get_feed_history`
        current_min_history_base: Base for Current minimal price retrieved by `get_feed_history`
        current_min_history_quote:  Quote for Current minimal price retrieved by `get_feed_history`
        hbd_amount_to_get: HBD amount to get.

    Returns:
        NaiAsset: Estimated HIVE collateral.

    Raises:
        CannotCreateAssetError/UnknownAssetTypeError/AssertionError: When passed asset is incorrect.
    """
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

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
@staticmethod
@abstractmethod
def get_operation_impacted_accounts(operation: Operation) -> list[AccountName]:
    """
    Retrieves the list of account names (not authorities!) that are impacted by a given operation.

    Args:
        operation: Operation in HF26 format or proto operation.

    Returns:
        list[AccountName]: list of account names impacted in operation.

    Raises:
        InvalidOperationFormatError, WaxValidationFailedError: When operation is incorrect.
    """
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
account
AccountName

Account name.

required
role
str

active | owner | posting | memo.

required
password
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
@staticmethod
@abstractmethod
def get_private_key_from_password(account: AccountName, role: str, password: str) -> IPrivateKeyData:
    """
    Returns private key data.

    Args:
        account: Account name.
        role: active | owner | posting | memo.
        password: the Master Password to derive key from.

    Returns:
        PrivateKeyData: generated private key along with the associated public key in WIF format.
    """
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
sig_digest
Hex

Digest data in hexadecimal format.

required
signature
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
@staticmethod
@abstractmethod
def 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.

    Args:
        sig_digest: Digest data in hexadecimal format.
        signature: Signature in hexadecimal format.

    Returns:
        PublicKey: Public key used in the signature

    Raises:
        WaxValidationFailedError: When passed parameters are wrong.
    """
hbd_to_hive abstractmethod

Converts given HBD into HIVE, both in nai form.

Parameters:

Name Type Description Default
hbd
HbdNaiAssetConvertible

HBD asset to be converted.

required
base
HbdNaiAssetConvertible

HBD asset price base.

required
quote
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
@abstractmethod
def hbd_to_hive(
    self, hbd: HbdNaiAssetConvertible, base: HbdNaiAssetConvertible, quote: HiveNaiAssetConvertible
) -> NaiAsset:
    """
    Converts given HBD into HIVE, both in nai form.

    Args:
        hbd: HBD asset to be converted.
        base: HBD asset price base.
        quote: HIVE asset price quote.

    Returns:
        NaiAsset: asset converted asset into HIVE.

    Raises:
        UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset it is incorrect.
    """
hive_to_hbd abstractmethod

Converts given HIVE into HBD, both in nai form.

Parameters:

Name Type Description Default
hive
HiveNaiAssetConvertible

HIVE asset to be converted.

required
base
HbdNaiAssetConvertible

HBD asset price base.

required
quote
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
@abstractmethod
def hive_to_hbd(
    self, hive: HiveNaiAssetConvertible, base: HbdNaiAssetConvertible, quote: HiveNaiAssetConvertible
) -> NaiAsset:
    """
    Converts given HIVE into HBD, both in nai form.

    Args:
        hive: HIVE asset to be converted.
        base: HBD asset price base.
        quote: HIVE asset price quote.

    Returns:
        NaiAsset: converted asset into HBD.

    Raises:
        UnknownAssetTypeError/CannotCreateAssetError/AssertionError: When passed asset is incorrect.
    """
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
account_name
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
@staticmethod
@abstractmethod
def is_valid_account_name(account_name: AccountName) -> bool:
    """
    Checks if the given account name is valid.

    Args:
        account_name: Account name to be checked.

    Returns:
        bool: True if the account name is valid, False otherwise.
    """
suggest_brain_key abstractmethod staticmethod
suggest_brain_key() -> IBrainKeyData

Returns brain key data.

Returns:

Name Type Description
BrainKeyData IBrainKeyData
  • brain key: a string containing space separated list of N words generated as a brain key (atm 16)
  • wif private key: first private key derived from above specified brain key
  • associated public key: base58 string pointing the public key associated to the private key
Source code in wax/interfaces.py
424
425
426
427
428
429
430
431
432
433
434
435
@staticmethod
@abstractmethod
def suggest_brain_key() -> IBrainKeyData:
    """
    Returns brain key data.

    Returns:
        BrainKeyData:
            * brain key: a string containing space separated list of N words generated as a brain key (atm 16)
            * wif private key: first private key derived from above specified brain key
            * associated public key: base58 string pointing the public key associated to the private key
    """
vests_to_hp abstractmethod

Converts given VESTS into HP, both in nai form.

Parameters:

Name Type Description Default
vests
VestsNaiAssetConvertible

VESTS asset.

required
total_vesting_fund_hive
HiveNaiAssetConvertible

HIVE asset total vesting fund.

required
total_vesting_shares
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
@abstractmethod
def vests_to_hp(
    self,
    vests: VestsNaiAssetConvertible,
    total_vesting_fund_hive: HiveNaiAssetConvertible,
    total_vesting_shares: VestsNaiAssetConvertible,
) -> NaiAsset:
    """
    Converts given VESTS into HP, both in nai form.

    Args:
        vests: VESTS asset.
        total_vesting_fund_hive: HIVE asset total vesting fund.
        total_vesting_shares: VESTS asset total vesting shares.

    Returns:
        NaiAsset: converted asset into HP (HIVE).

    Raises:
        CannotCreateAssetError/UnknownAssetTypeError/AssertionError: When passed asset is incorrect.
    """

models

asset

AnyNaiAssetConvertible module-attribute

Type alias for types convertible to any of the HIVE, HBD, or VESTS nai formats.

AssetAmount module-attribute
AssetAmount = int | float | Decimal

Type alias for an number that can be used as an amount of an asset.

HbdNaiAssetConvertible module-attribute
HbdNaiAssetConvertible = (
    NaiAsset | dict[str, str | int] | str
)

Type alias for types convertible to Hbd nai format.

HiveNaiAssetConvertible module-attribute
HiveNaiAssetConvertible = (
    NaiAsset | dict[str, str | int] | str
)

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
VestsNaiAssetConvertible = (
    NaiAsset | dict[str, str | int] | str
)

Type alias for types convertible to Vests nai format.

AssetFactory

Bases: Protocol

coins staticmethod

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
@staticmethod
def coins(amount: AssetAmount) -> NaiAsset:
    """
    Returns asset in nai/HF26 format with given amount.

    Please notice that this function works with precision!

    Args:
        amount: amount of the asset.

    Returns:
        NaiAsset: asset in nai form.

    Raises:
        DecimalConversionNotANumberError: Raised when given amount is in invalid format.
    """
satoshis staticmethod
satoshis(amount: int) -> NaiAsset

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
@staticmethod
def satoshis(amount: int) -> NaiAsset:
    """
    Returns asset in nai/HF26 format with given amount.

    Please notice that this function works without precision and accept only integers!

    Args:
        amount: amount of the asset.

    Returns:
        NaiAsset: asset in nai form.

    Raises:
        TypeError: If given amount is not integer.
    """
AssetInfo dataclass
AssetInfo(nai: str, precision: int)

Represents information about an asset.

AssetName

Bases: Enum

Enum representing the names of assets in the Hive blockchain.

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: TypeAlias = dict[PublicKey, int]

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: TypeAlias = str

AccountName is a type alias for the name of an account on the Hive blockchain.

ChainId module-attribute
ChainId: TypeAlias = Hex

ChainId is a type alias for the chain identifier of the Hive blockchain.

HeadBlockId module-attribute
HeadBlockId: TypeAlias = Hex

HeadBlockId is a type alias for the identifier of the head block.

Hex module-attribute
Hex: TypeAlias = str

Hex is a type alias for a hexadecimal string.

PublicKey module-attribute
PublicKey: TypeAlias = str

PublicKey is a type alias for a public key in the Hive blockchain.

SigDigest module-attribute
SigDigest: TypeAlias = Hex

SigDigest is a type alias for the signature digest of a transaction.

Signature module-attribute
Signature: TypeAlias = Hex

Signature is a type alias for a hexadecimal string representing a signature.

TransactionId module-attribute
TransactionId: TypeAlias = Hex

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.

brain_key abstractmethod property
brain_key: str

Get brain key.

IPrivateKeyData

Bases: ABC

Interface for private key data.

associated_public_key abstractmethod property
associated_public_key: str

Get associated public key.

wif_private_key abstractmethod property
wif_private_key: str

Get WIF private key.

operations

Operation module-attribute

Either a proto or a protocol(hf26) operation.

ProtoOperation module-attribute
ProtoOperation: TypeAlias = dict[str, Any] | str | Message

ProtoOperation is a type alias for a type that can be converted to a proto message.

ProtocolOperation module-attribute
ProtocolOperation: TypeAlias = dict[str, Any] | str

ProtocolOperation is a type alias for the operation in the protocol (hf26) format.

WaxMetaOperation module-attribute
WaxMetaOperation: TypeAlias = Message | OperationBase

WaxMetaOperation is a type alias for a protobuf message or an OperationBase instance.

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

active property
active: authority

@param {authority} active

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.

json_metadata instance-attribute
json_metadata: str

@param {string} json_metadata

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 '-'.

owner property
owner: authority

@param {authority} owner

posting property
posting: authority

@param {authority} posting

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 instance-attribute
account: str

@param {string} account

proxy instance-attribute
proxy: str

@param {string} proxy - Account name. To remove the proxy, the parameter should be set empty. Only one proxy may be set for an account.

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

account instance-attribute
account: str

@param {string} account

approve instance-attribute
approve: bool

@param {bool} approve - To vote for the witness, the approve = true. To remove the vote, the approve = false.

witness instance-attribute
witness: str

@param {string} witness - Witness account.

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

from_account instance-attribute
from_account: str

@param {string} from_account

request_id instance-attribute
request_id: int

@param {number} request_id

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

account_to_recover instance-attribute
account_to_recover: str

@param {string} account_to_recover

extensions property
extensions: RepeatedCompositeFieldContainer[
    future_extensions
]

@param {future_extensions} extensions

new_recovery_account instance-attribute
new_recovery_account: str

@param {string} new_recovery_account

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

creator instance-attribute
creator: str

@param {string} creator - Account name.

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

account instance-attribute
account: str

@param {string} account - Account name.

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

amount property
amount: asset

@param {asset} amount - Amount > 0, have to be in Hive.

owner instance-attribute
owner: str

@param {string} owner - Account name.

requestid instance-attribute
requestid: int

@param {number} requestid - The number is given by a user. Should be unique for a user.

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

hbd_out property
hbd_out: asset

@param {asset} hbd_out - (HBD) funds after conversion

owner instance-attribute
owner: str

@param {string} owner - user that requested conversion (receiver of hbd_out)

requestid instance-attribute
requestid: int

@param {number} requested - id of the conversion 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: 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: 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

amount property
amount: asset

@param {asset} amount - Amount > 0, have to be in HBD.

owner instance-attribute
owner: str

@param {string} owner - Account name.

requestid instance-attribute
requestid: int

@param {number} requestid - The number is given by a user. Should be unique for a user.

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

active property
active: authority

@param {authority} active

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.

json_metadata instance-attribute
json_metadata: str

@param {string} json_metadata - Json string.

memo_key instance-attribute
memo_key: str

@param {string} memo_key

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 “-“.

owner property
owner: authority

@param {authority} owner

posting property
posting: authority

@param {authority} posting

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

creator instance-attribute
creator: str

@param {string} creator

daily_pay property
daily_pay: asset

@param {asset} daily_pay

end_date instance-attribute
end_date: str

@param {asset} end_date

extensions property
extensions: RepeatedCompositeFieldContainer[
    future_extensions
]

@param {future_extensions} extensions

permlink: str

@param {string} permlink

receiver instance-attribute
receiver: str

@param {string} receiver

start_date instance-attribute
start_date: str

@param {string} start_date

subject instance-attribute
subject: str

@param {string} subject

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

data instance-attribute
data: str

@param {string} data

id instance-attribute
id: int

@param {number} id

required_auths property
required_auths: RepeatedScalarFieldContainer[str]

@param {string} required_auths

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

id instance-attribute
id: str

@param {string} id - Must be less than 32 characters long.

json instance-attribute
json: str

@param {string} json - Must be a proper utf8 JSON string.

required_auths property
required_auths: RepeatedScalarFieldContainer[str]

@param {string} required_auths

required_posting_auths property
required_posting_auths: RepeatedScalarFieldContainer[str]

@param {string} required_posting_auths

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

account instance-attribute
account: str

@param {string} account - Account name.

decline instance-attribute
decline: bool

@param {bool} decline

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

author instance-attribute
author: str

@param {string} author - Account name, the author of the post or the comment.

permlink: str

@param {string} permlink - The identifier of the post or the comment.

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.

author instance-attribute
author: str

@param {string} author - author of comment voted on

pending_payout property
pending_payout: asset

@param {asset} pending_payout - (HBD) estimated reward on target comment; supplemented by AH RocksDB plugin

permlink: str

@param {string} permlink - permlink of comment voted on

rshares instance-attribute
rshares: int

@param {number} rshares - power of the vote

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

voter instance-attribute
voter: str

@param {string} voter - account that casts a 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

agent instance-attribute
agent: str

@param {string} agent - Account name.

approve instance-attribute
approve: bool

@param {bool} approve - approve = true; (approve = false explicitly rejects the escrow)

escrow_id instance-attribute
escrow_id: int

@param {number} escrow_id - Escrow identifier.

from_account instance-attribute
from_account: str

@param {string} from_account - Account name.

to_account instance-attribute
to_account: str

@param {string} to_account - Account name.

who instance-attribute
who: str

@param {string} who - Account name. Either {to} or {agent}.

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

agent instance-attribute
agent: str

@param {string} agent - Account name.

escrow_id instance-attribute
escrow_id: int

@param {number} escrow_id - Escrow identifier.

from_account instance-attribute
from_account: str

@param {string} from_account - Account name.

to_account instance-attribute
to_account: str

@param {string} to_account - Account name.

who instance-attribute
who: str

@param {string} who - Account name. Either {to} or {agent}.

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

agent instance-attribute
agent: str

@param {string} agent - Account name.

escrow_id instance-attribute
escrow_id: int

@param {number} escrow_id - Escrow indicator.

from_account instance-attribute
from_account: str

@param {string} from_account - Account name.

hbd_amount property
hbd_amount: asset

@param {asset} hbd_amount - The amount of HBD to release.

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}).

to_account instance-attribute
to_account: str

@param {string} to_account - Account name.

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

agent instance-attribute
agent: str

@param {string} agent - Account name.

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.

from_account instance-attribute
from_account: str

@param {string} from_account - Account name.

hbd_amount property
hbd_amount: asset

@param {asset} hbd_amount - Escrow amount.

hive_amount property
hive_amount: asset

@param {asset} hive_amount - Escrow amount.

json_meta instance-attribute
json_meta: str

@param {string} json_meta - json string.

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 }.

to_account instance-attribute
to_account: str

@param {string} to_account - Account name.

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

exchange_rate property
exchange_rate: price

@param {price} exchange_rate - How many HBD the 1 Hive should cost Example: "base":"0.345 HBD","quote":"1.000 HIVE"

publisher instance-attribute
publisher: str

@param {string} publisher - The witness.

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

orderid instance-attribute
orderid: int

@param {number} orderid - The request_id provided by a user during creating a limit_order_create_operation or limit_order_create2_operation.

owner instance-attribute
owner: str

@param {string} owner

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

amount_to_sell property
amount_to_sell: asset

@param {asset} amount_to_sell

expiration instance-attribute
expiration: str

@param {string} expiration

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'.

min_to_receive property
min_to_receive: asset

@param {asset} min_to_receive

orderid instance-attribute
orderid: int

@param {number} orderid - an ID assigned by owner, must be unique.

owner instance-attribute
owner: str

@param {string} owner

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

amount_to_sell property
amount_to_sell: asset

@param {asset} amount_to_sell

exchange_rate property
exchange_rate: price

@param {price} exchange_rate

expiration instance-attribute
expiration: str

@param {string} expiration

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.

owner instance-attribute
owner: str

@param {string} owner

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.

fill_convert_request property
fill_convert_request: fill_convert_request

Virtual operations:

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'.

from_account instance-attribute
from_account: str

@param {string} from_account

memo instance-attribute
memo: str

@param {string} memo - must be shorter than 2048.

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

extensions property
extensions: RepeatedCompositeFieldContainer[
    future_extensions
]

@param {future_extensions} extensions

proposal_ids property
proposal_ids: RepeatedScalarFieldContainer[int]

@param {number} proposal_ids

proposal_owner instance-attribute
proposal_owner: str

@param {string} proposal_owner

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.

from_account instance-attribute
from_account: str

@param {string} from_account - Account name.

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.

to_account instance-attribute
to_account: str

@param {string} to_account - Account name.

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

amount property
amount: asset

@param {asset} amount - Must be HIVE, amount > 0.

from_account instance-attribute
from_account: str

@param {string} from_account - The account the funds are coming from.

to_account instance-attribute
to_account: str

@param {string} to_account - The account the funds are going to. If null, then the same as 'from_account'.

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

creator instance-attribute
creator: str

@param {string} creator

daily_pay property
daily_pay: asset

@param {asset} daily_pay

extensions property
extensions: RepeatedCompositeFieldContainer[
    global___update_proposal_extension
]

@param {update_proposal_extension} extensions

permlink: str

@param {string} permlinks

proposal_id instance-attribute
proposal_id: int

@param {number} proposal_id

subject instance-attribute
subject: str

@param {string} subject

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.

voter instance-attribute
voter: str

@param {string} voter - Account name.

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: str

@param {string} permlink - The identifier of the post or comment.

voter instance-attribute
voter: str

@param {string} voter - Account name.

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

account instance-attribute
account: str

@param {string} account - The account the funds are coming from.

vesting_shares property
vesting_shares: asset

@param {asset} vesting_shares - Amount of VESTS (HP)

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

block_id instance-attribute
block_id: str

@param {string} block_id

witness instance-attribute
witness: str

@param {string} witness

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

owner instance-attribute
owner: str

@param {string} owner - Witness account name.

props property
props: ScalarMap[str, str]

@param {map} props - There are the following properties available in the {props}: account_creation_fee, account_subsidy_budget, account_subsidy_decay, maximum_block_size, hbd_interest_rate. hbd_exchange_rate, url and new_signing_key.

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.

props property
props: legacy_chain_properties

@param {legacy_chain_properties} props

url instance-attribute
url: str

@param {string} url - url to information about witness.

transaction

transaction
transaction(
    *,
    ref_block_num: int | None = ...,
    ref_block_prefix: int | None = ...,
    expiration: str | None = ...,
    operations: Iterable[operation] | None = ...,
    extensions: Iterable[future_extensions] | None = ...,
    signatures: Iterable[str] | None = ...
)

Bases: Message

signatures property
signatures: RepeatedScalarFieldContainer[str]

for signed_transaction

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
def create_hive_chain(options: WaxChainOptions | None = None) -> IHiveChainInterface[ApiCollectionT | WaxApiCollection]:
    """Factory function to provide hive chain interface functionality."""
    options = options if options is not None else WaxChainOptions()
    chain_id = options.chain_id
    endpoint_url = options.endpoint_url

    return HiveChainApi(chain_id, endpoint_url, _private=True)

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
def create_wax_foundation(options: WaxOptions | None = None) -> IWaxBaseInterface:
    """Factory function to provide wax base interface functionality."""
    chain_id = options.chain_id if options is not None else WaxOptions().chain_id

    return WaxBaseApi(chain_id, _private=True)

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
chain_id
ChainId | str

chain id used for signing. Defaults to mainnet chain id.

DEFAULT_CHAIN_ID
endpoint_url
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
def __init__(
    self,
    chain_id: ChainId | str = DEFAULT_CHAIN_ID,
    endpoint_url: HttpUrl | str = DEFAULT_ENDPOINT_URL,
) -> None:
    """
    Constructs WaxChainOptions.

    Args:
        chain_id: chain id used for signing. Defaults to mainnet chain id.
        endpoint_url: url of the node to connect to. Defaults to mainnet (hive.blog) node.

    Raises:
        InvalidEndpointUrlFormatError: if endpoint_url is not valid.
    """
    super().__init__(chain_id)
    self._endpoint_url = convert_to_http_url(endpoint_url)

WaxOptions

WaxOptions(chain_id: ChainId = DEFAULT_CHAIN_ID)

Allows configuration of wax itself.

Constructs WaxOptions.

Parameters:

Name Type Description Default
chain_id
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
def __init__(self, chain_id: ChainId = DEFAULT_CHAIN_ID) -> None:
    """
    Constructs WaxOptions.

    Args:
        chain_id: chain id used for signing. Defaults to mainnet chain id.
    """
    self.chain_id = chain_id

wax_visitor

AbstractOperationVisitor

Bases: ABC

User must overrides all the abstract methods in derived visitor class.

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.