Class Helpers


  • public final class Helpers
    extends Object
    • Constructor Detail

      • Helpers

        public Helpers()
    • Method Detail

      • encode_cast_vote_script_function

        public static TransactionPayload encode_cast_vote_script_function​(TypeTag token,
                                                                          TypeTag action_t,
                                                                          AccountAddress proposer_address,
                                                                          Long proposal_id,
                                                                          Boolean agree,
                                                                          BigInteger votes)
        Parameters:
        token - TypeTag value
        action_t - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        agree - Boolean value
        votes - @Unsigned @Int128 BigInteger value
        Returns:
        Encoded TransactionPayload value.
      • encode_convert_TwoPhaseUpgrade_to_TwoPhaseUpgradeV2_script_function

        public static TransactionPayload encode_convert_TwoPhaseUpgrade_to_TwoPhaseUpgradeV2_script_function​(AccountAddress package_address)
        Parameters:
        package_address - AccountAddress value
        Returns:
        Encoded TransactionPayload value.
      • encode_create_account_with_initial_amount_script_function

        public static TransactionPayload encode_create_account_with_initial_amount_script_function​(TypeTag token_type,
                                                                                                   AccountAddress fresh_address,
                                                                                                   Bytes _auth_key,
                                                                                                   BigInteger initial_amount)
        Parameters:
        token_type - TypeTag value
        fresh_address - AccountAddress value
        _auth_key - Bytes value
        initial_amount - @Unsigned @Int128 BigInteger value
        Returns:
        Encoded TransactionPayload value.
      • encode_create_account_with_initial_amount_v2_script_function

        public static TransactionPayload encode_create_account_with_initial_amount_v2_script_function​(TypeTag token_type,
                                                                                                      AccountAddress fresh_address,
                                                                                                      BigInteger initial_amount)
        Parameters:
        token_type - TypeTag value
        fresh_address - AccountAddress value
        initial_amount - @Unsigned @Int128 BigInteger value
        Returns:
        Encoded TransactionPayload value.
      • encode_destroy_terminated_proposal_script_function

        public static TransactionPayload encode_destroy_terminated_proposal_script_function​(TypeTag token_t,
                                                                                            TypeTag action_t,
                                                                                            AccountAddress proposer_address,
                                                                                            Long proposal_id)
        remove terminated proposal from proposer
        Parameters:
        token_t - TypeTag value
        action_t - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_execute_script_function

        public static TransactionPayload encode_execute_script_function​(TypeTag token_t,
                                                                        AccountAddress proposer_address,
                                                                        Long proposal_id)
        Once the proposal is agreed, anyone can call the method to make the proposal happen.
        Parameters:
        token_t - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_execute_on_chain_config_proposal_script_function

        public static TransactionPayload encode_execute_on_chain_config_proposal_script_function​(TypeTag config_t,
                                                                                                 Long proposal_id)
        Parameters:
        config_t - TypeTag value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_execute_withdraw_proposal_script_function

        public static TransactionPayload encode_execute_withdraw_proposal_script_function​(TypeTag token_t,
                                                                                          AccountAddress proposer_address,
                                                                                          Long proposal_id)
        Parameters:
        token_t - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_initialize_script_function

        public static TransactionPayload encode_initialize_script_function​(Long stdlib_version,
                                                                           Long reward_delay,
                                                                           BigInteger pre_mine_stc_amount,
                                                                           BigInteger time_mint_stc_amount,
                                                                           Long time_mint_stc_period,
                                                                           Bytes parent_hash,
                                                                           Bytes association_auth_key,
                                                                           Bytes genesis_auth_key,
                                                                           Byte chain_id,
                                                                           Long genesis_timestamp,
                                                                           Long uncle_rate_target,
                                                                           Long epoch_block_count,
                                                                           Long base_block_time_target,
                                                                           Long base_block_difficulty_window,
                                                                           BigInteger base_reward_per_block,
                                                                           Long base_reward_per_uncle_percent,
                                                                           Long min_block_time_target,
                                                                           Long max_block_time_target,
                                                                           Long base_max_uncles_per_block,
                                                                           Long base_block_gas_limit,
                                                                           Byte strategy,
                                                                           Boolean script_allowed,
                                                                           Boolean module_publishing_allowed,
                                                                           Bytes instruction_schedule,
                                                                           Bytes native_schedule,
                                                                           Long global_memory_per_byte_cost,
                                                                           Long global_memory_per_byte_write_cost,
                                                                           Long min_transaction_gas_units,
                                                                           Long large_transaction_cutoff,
                                                                           Long instrinsic_gas_per_byte,
                                                                           Long maximum_number_of_gas_units,
                                                                           Long min_price_per_gas_unit,
                                                                           Long max_price_per_gas_unit,
                                                                           Long max_transaction_size_in_bytes,
                                                                           Long gas_unit_scaling_factor,
                                                                           Long default_account_size,
                                                                           Long voting_delay,
                                                                           Long voting_period,
                                                                           Byte voting_quorum_rate,
                                                                           Long min_action_delay,
                                                                           Long transaction_timeout)
        Parameters:
        stdlib_version - @Unsigned Long value
        reward_delay - @Unsigned Long value
        pre_mine_stc_amount - @Unsigned @Int128 BigInteger value
        time_mint_stc_amount - @Unsigned @Int128 BigInteger value
        time_mint_stc_period - @Unsigned Long value
        parent_hash - Bytes value
        association_auth_key - Bytes value
        genesis_auth_key - Bytes value
        chain_id - @Unsigned Byte value
        genesis_timestamp - @Unsigned Long value
        uncle_rate_target - @Unsigned Long value
        epoch_block_count - @Unsigned Long value
        base_block_time_target - @Unsigned Long value
        base_block_difficulty_window - @Unsigned Long value
        base_reward_per_block - @Unsigned @Int128 BigInteger value
        base_reward_per_uncle_percent - @Unsigned Long value
        min_block_time_target - @Unsigned Long value
        max_block_time_target - @Unsigned Long value
        base_max_uncles_per_block - @Unsigned Long value
        base_block_gas_limit - @Unsigned Long value
        strategy - @Unsigned Byte value
        script_allowed - Boolean value
        module_publishing_allowed - Boolean value
        instruction_schedule - Bytes value
        native_schedule - Bytes value
        global_memory_per_byte_cost - @Unsigned Long value
        global_memory_per_byte_write_cost - @Unsigned Long value
        min_transaction_gas_units - @Unsigned Long value
        large_transaction_cutoff - @Unsigned Long value
        instrinsic_gas_per_byte - @Unsigned Long value
        maximum_number_of_gas_units - @Unsigned Long value
        min_price_per_gas_unit - @Unsigned Long value
        max_price_per_gas_unit - @Unsigned Long value
        max_transaction_size_in_bytes - @Unsigned Long value
        gas_unit_scaling_factor - @Unsigned Long value
        default_account_size - @Unsigned Long value
        voting_delay - @Unsigned Long value
        voting_period - @Unsigned Long value
        voting_quorum_rate - @Unsigned Byte value
        min_action_delay - @Unsigned Long value
        transaction_timeout - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_initialize_v2_script_function

        public static TransactionPayload encode_initialize_v2_script_function​(Long stdlib_version,
                                                                              Long reward_delay,
                                                                              BigInteger total_stc_amount,
                                                                              BigInteger pre_mine_stc_amount,
                                                                              BigInteger time_mint_stc_amount,
                                                                              Long time_mint_stc_period,
                                                                              Bytes parent_hash,
                                                                              Bytes association_auth_key,
                                                                              Bytes genesis_auth_key,
                                                                              Byte chain_id,
                                                                              Long genesis_timestamp,
                                                                              Long uncle_rate_target,
                                                                              Long epoch_block_count,
                                                                              Long base_block_time_target,
                                                                              Long base_block_difficulty_window,
                                                                              BigInteger base_reward_per_block,
                                                                              Long base_reward_per_uncle_percent,
                                                                              Long min_block_time_target,
                                                                              Long max_block_time_target,
                                                                              Long base_max_uncles_per_block,
                                                                              Long base_block_gas_limit,
                                                                              Byte strategy,
                                                                              Boolean script_allowed,
                                                                              Boolean module_publishing_allowed,
                                                                              Bytes instruction_schedule,
                                                                              Bytes native_schedule,
                                                                              Long global_memory_per_byte_cost,
                                                                              Long global_memory_per_byte_write_cost,
                                                                              Long min_transaction_gas_units,
                                                                              Long large_transaction_cutoff,
                                                                              Long instrinsic_gas_per_byte,
                                                                              Long maximum_number_of_gas_units,
                                                                              Long min_price_per_gas_unit,
                                                                              Long max_price_per_gas_unit,
                                                                              Long max_transaction_size_in_bytes,
                                                                              Long gas_unit_scaling_factor,
                                                                              Long default_account_size,
                                                                              Long voting_delay,
                                                                              Long voting_period,
                                                                              Byte voting_quorum_rate,
                                                                              Long min_action_delay,
                                                                              Long transaction_timeout)
        Parameters:
        stdlib_version - @Unsigned Long value
        reward_delay - @Unsigned Long value
        total_stc_amount - @Unsigned @Int128 BigInteger value
        pre_mine_stc_amount - @Unsigned @Int128 BigInteger value
        time_mint_stc_amount - @Unsigned @Int128 BigInteger value
        time_mint_stc_period - @Unsigned Long value
        parent_hash - Bytes value
        association_auth_key - Bytes value
        genesis_auth_key - Bytes value
        chain_id - @Unsigned Byte value
        genesis_timestamp - @Unsigned Long value
        uncle_rate_target - @Unsigned Long value
        epoch_block_count - @Unsigned Long value
        base_block_time_target - @Unsigned Long value
        base_block_difficulty_window - @Unsigned Long value
        base_reward_per_block - @Unsigned @Int128 BigInteger value
        base_reward_per_uncle_percent - @Unsigned Long value
        min_block_time_target - @Unsigned Long value
        max_block_time_target - @Unsigned Long value
        base_max_uncles_per_block - @Unsigned Long value
        base_block_gas_limit - @Unsigned Long value
        strategy - @Unsigned Byte value
        script_allowed - Boolean value
        module_publishing_allowed - Boolean value
        instruction_schedule - Bytes value
        native_schedule - Bytes value
        global_memory_per_byte_cost - @Unsigned Long value
        global_memory_per_byte_write_cost - @Unsigned Long value
        min_transaction_gas_units - @Unsigned Long value
        large_transaction_cutoff - @Unsigned Long value
        instrinsic_gas_per_byte - @Unsigned Long value
        maximum_number_of_gas_units - @Unsigned Long value
        min_price_per_gas_unit - @Unsigned Long value
        max_price_per_gas_unit - @Unsigned Long value
        max_transaction_size_in_bytes - @Unsigned Long value
        gas_unit_scaling_factor - @Unsigned Long value
        default_account_size - @Unsigned Long value
        voting_delay - @Unsigned Long value
        voting_period - @Unsigned Long value
        voting_quorum_rate - @Unsigned Byte value
        min_action_delay - @Unsigned Long value
        transaction_timeout - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_peer_to_peer_script_function

        public static TransactionPayload encode_peer_to_peer_script_function​(TypeTag token_type,
                                                                             AccountAddress payee,
                                                                             Bytes _payee_auth_key,
                                                                             BigInteger amount)
        Parameters:
        token_type - TypeTag value
        payee - AccountAddress value
        _payee_auth_key - Bytes value
        amount - @Unsigned @Int128 BigInteger value
        Returns:
        Encoded TransactionPayload value.
      • encode_peer_to_peer_batch_script_function

        public static TransactionPayload encode_peer_to_peer_batch_script_function​(TypeTag token_type,
                                                                                   Bytes _payeees,
                                                                                   Bytes _payee_auth_keys,
                                                                                   BigInteger _amount)
        Parameters:
        token_type - TypeTag value
        _payeees - Bytes value
        _payee_auth_keys - Bytes value
        _amount - @Unsigned @Int128 BigInteger value
        Returns:
        Encoded TransactionPayload value.
      • encode_peer_to_peer_v2_script_function

        public static TransactionPayload encode_peer_to_peer_v2_script_function​(TypeTag token_type,
                                                                                AccountAddress payee,
                                                                                BigInteger amount)
        Parameters:
        token_type - TypeTag value
        payee - AccountAddress value
        amount - @Unsigned @Int128 BigInteger value
        Returns:
        Encoded TransactionPayload value.
      • encode_peer_to_peer_with_metadata_script_function

        public static TransactionPayload encode_peer_to_peer_with_metadata_script_function​(TypeTag token_type,
                                                                                           AccountAddress payee,
                                                                                           Bytes _payee_auth_key,
                                                                                           BigInteger amount,
                                                                                           Bytes metadata)
        Parameters:
        token_type - TypeTag value
        payee - AccountAddress value
        _payee_auth_key - Bytes value
        amount - @Unsigned @Int128 BigInteger value
        metadata - Bytes value
        Returns:
        Encoded TransactionPayload value.
      • encode_peer_to_peer_with_metadata_v2_script_function

        public static TransactionPayload encode_peer_to_peer_with_metadata_v2_script_function​(TypeTag token_type,
                                                                                              AccountAddress payee,
                                                                                              BigInteger amount,
                                                                                              Bytes metadata)
        Parameters:
        token_type - TypeTag value
        payee - AccountAddress value
        amount - @Unsigned @Int128 BigInteger value
        metadata - Bytes value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_script_function

        public static TransactionPayload encode_propose_script_function​(TypeTag token_t,
                                                                        Long voting_delay,
                                                                        Long voting_period,
                                                                        Byte voting_quorum_rate,
                                                                        Long min_action_delay,
                                                                        Long exec_delay)
        Entrypoint for the proposal.
        Parameters:
        token_t - TypeTag value
        voting_delay - @Unsigned Long value
        voting_period - @Unsigned Long value
        voting_quorum_rate - @Unsigned Byte value
        min_action_delay - @Unsigned Long value
        exec_delay - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_module_upgrade_v2_script_function

        public static TransactionPayload encode_propose_module_upgrade_v2_script_function​(TypeTag token,
                                                                                          AccountAddress module_address,
                                                                                          Bytes package_hash,
                                                                                          Long version,
                                                                                          Long exec_delay,
                                                                                          Boolean enforced)
        Parameters:
        token - TypeTag value
        module_address - AccountAddress value
        package_hash - Bytes value
        version - @Unsigned Long value
        exec_delay - @Unsigned Long value
        enforced - Boolean value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_update_consensus_config_script_function

        public static TransactionPayload encode_propose_update_consensus_config_script_function​(Long uncle_rate_target,
                                                                                                Long base_block_time_target,
                                                                                                BigInteger base_reward_per_block,
                                                                                                Long base_reward_per_uncle_percent,
                                                                                                Long epoch_block_count,
                                                                                                Long base_block_difficulty_window,
                                                                                                Long min_block_time_target,
                                                                                                Long max_block_time_target,
                                                                                                Long base_max_uncles_per_block,
                                                                                                Long base_block_gas_limit,
                                                                                                Byte strategy,
                                                                                                Long exec_delay)
        Parameters:
        uncle_rate_target - @Unsigned Long value
        base_block_time_target - @Unsigned Long value
        base_reward_per_block - @Unsigned @Int128 BigInteger value
        base_reward_per_uncle_percent - @Unsigned Long value
        epoch_block_count - @Unsigned Long value
        base_block_difficulty_window - @Unsigned Long value
        min_block_time_target - @Unsigned Long value
        max_block_time_target - @Unsigned Long value
        base_max_uncles_per_block - @Unsigned Long value
        base_block_gas_limit - @Unsigned Long value
        strategy - @Unsigned Byte value
        exec_delay - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_update_reward_config_script_function

        public static TransactionPayload encode_propose_update_reward_config_script_function​(Long reward_delay,
                                                                                             Long exec_delay)
        Parameters:
        reward_delay - @Unsigned Long value
        exec_delay - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_update_txn_publish_option_script_function

        public static TransactionPayload encode_propose_update_txn_publish_option_script_function​(Boolean script_allowed,
                                                                                                  Boolean module_publishing_allowed,
                                                                                                  Long exec_delay)
        Parameters:
        script_allowed - Boolean value
        module_publishing_allowed - Boolean value
        exec_delay - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_update_txn_timeout_config_script_function

        public static TransactionPayload encode_propose_update_txn_timeout_config_script_function​(Long duration_seconds,
                                                                                                  Long exec_delay)
        Parameters:
        duration_seconds - @Unsigned Long value
        exec_delay - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_update_vm_config_script_function

        public static TransactionPayload encode_propose_update_vm_config_script_function​(Bytes instruction_schedule,
                                                                                         Bytes native_schedule,
                                                                                         Long global_memory_per_byte_cost,
                                                                                         Long global_memory_per_byte_write_cost,
                                                                                         Long min_transaction_gas_units,
                                                                                         Long large_transaction_cutoff,
                                                                                         Long instrinsic_gas_per_byte,
                                                                                         Long maximum_number_of_gas_units,
                                                                                         Long min_price_per_gas_unit,
                                                                                         Long max_price_per_gas_unit,
                                                                                         Long max_transaction_size_in_bytes,
                                                                                         Long gas_unit_scaling_factor,
                                                                                         Long default_account_size,
                                                                                         Long exec_delay)
        Parameters:
        instruction_schedule - Bytes value
        native_schedule - Bytes value
        global_memory_per_byte_cost - @Unsigned Long value
        global_memory_per_byte_write_cost - @Unsigned Long value
        min_transaction_gas_units - @Unsigned Long value
        large_transaction_cutoff - @Unsigned Long value
        instrinsic_gas_per_byte - @Unsigned Long value
        maximum_number_of_gas_units - @Unsigned Long value
        min_price_per_gas_unit - @Unsigned Long value
        max_price_per_gas_unit - @Unsigned Long value
        max_transaction_size_in_bytes - @Unsigned Long value
        gas_unit_scaling_factor - @Unsigned Long value
        default_account_size - @Unsigned Long value
        exec_delay - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_propose_withdraw_script_function

        public static TransactionPayload encode_propose_withdraw_script_function​(TypeTag token_t,
                                                                                 AccountAddress receiver,
                                                                                 BigInteger amount,
                                                                                 Long period,
                                                                                 Long exec_delay)
        Parameters:
        token_t - TypeTag value
        receiver - AccountAddress value
        amount - @Unsigned @Int128 BigInteger value
        period - @Unsigned Long value
        exec_delay - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_queue_proposal_action_script_function

        public static TransactionPayload encode_queue_proposal_action_script_function​(TypeTag token_t,
                                                                                      TypeTag action_t,
                                                                                      AccountAddress proposer_address,
                                                                                      Long proposal_id)
        queue agreed proposal to execute.
        Parameters:
        token_t - TypeTag value
        action_t - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_revoke_vote_script_function

        public static TransactionPayload encode_revoke_vote_script_function​(TypeTag token,
                                                                            TypeTag action,
                                                                            AccountAddress proposer_address,
                                                                            Long proposal_id)
        Parameters:
        token - TypeTag value
        action - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_rotate_authentication_key_script_function

        public static TransactionPayload encode_rotate_authentication_key_script_function​(Bytes new_key)
        Parameters:
        new_key - Bytes value
        Returns:
        Encoded TransactionPayload value.
      • encode_submit_module_upgrade_plan_script_function

        public static TransactionPayload encode_submit_module_upgrade_plan_script_function​(TypeTag token,
                                                                                           AccountAddress proposer_address,
                                                                                           Long proposal_id)
        Parameters:
        token - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_take_linear_withdraw_capability_script_function

        public static TransactionPayload encode_take_linear_withdraw_capability_script_function()
        association account should call this script after upgrade from v2 to v3.
        Returns:
        Encoded TransactionPayload value.
      • encode_take_offer_script_function

        public static TransactionPayload encode_take_offer_script_function​(TypeTag offered,
                                                                           AccountAddress offer_address)
        Take Offer and put to signer's Collection<Offered>.
        Parameters:
        offered - TypeTag value
        offer_address - AccountAddress value
        Returns:
        Encoded TransactionPayload value.
      • encode_unstake_vote_script_function

        public static TransactionPayload encode_unstake_vote_script_function​(TypeTag token,
                                                                             TypeTag action,
                                                                             AccountAddress proposer_address,
                                                                             Long proposal_id)
        Parameters:
        token - TypeTag value
        action - TypeTag value
        proposer_address - AccountAddress value
        proposal_id - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_update_module_upgrade_strategy_script_function

        public static TransactionPayload encode_update_module_upgrade_strategy_script_function​(Byte strategy)
        Parameters:
        strategy - @Unsigned Byte value
        Returns:
        Encoded TransactionPayload value.
      • encode_upgrade_from_v2_to_v3_script_function

        public static TransactionPayload encode_upgrade_from_v2_to_v3_script_function​(BigInteger total_stc_amount)
        Stdlib upgrade script from v2 to v3
        Parameters:
        total_stc_amount - @Unsigned @Int128 BigInteger value
        Returns:
        Encoded TransactionPayload value.
      • encode_withdraw_and_split_lt_withdraw_cap_script_function

        public static TransactionPayload encode_withdraw_and_split_lt_withdraw_cap_script_function​(TypeTag token_t,
                                                                                                   AccountAddress for_address,
                                                                                                   BigInteger amount,
                                                                                                   Long lock_period)
        Parameters:
        token_t - TypeTag value
        for_address - AccountAddress value
        amount - @Unsigned @Int128 BigInteger value
        lock_period - @Unsigned Long value
        Returns:
        Encoded TransactionPayload value.
      • encode_withdraw_token_with_linear_withdraw_capability_script_function

        public static TransactionPayload encode_withdraw_token_with_linear_withdraw_capability_script_function​(TypeTag token_t)
        Parameters:
        token_t - TypeTag value
        Returns:
        Encoded TransactionPayload value.