Some checks failed
morphit-release / Build + publish release tarball (push) Has been cancelled
80 lines
3.7 KiB
TypeScript
80 lines
3.7 KiB
TypeScript
/**
|
|
* @file Account helpers.
|
|
* @author BeBlurt <https://beblurt.com/@beblurt>
|
|
* @description Special account functions
|
|
* @license
|
|
* Copyright (c) 2022 BeBlurt. All Rights Reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
* are permitted provided that the following conditions are met:
|
|
*
|
|
* 1. Redistribution of source code must retain the above copyright notice, this
|
|
* list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistribution in binary form must reproduce the above copyright notice,
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
* and/or other materials provided with the distribution.
|
|
*
|
|
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software without
|
|
* specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
* You acknowledge that this software is not designed, licensed or intended for use
|
|
* in the design, construction, operation or maintenance of any military facility.
|
|
*/
|
|
import { DynamicGlobalProperties, RewardFund, WitnessSetProperties } from '../chain/misc';
|
|
import { WitnessSetPropertiesOperation } from '../chain/operation';
|
|
import { Serializer } from '../chain/serializer';
|
|
import { Client } from '../client';
|
|
export declare class Tools {
|
|
readonly client: Client;
|
|
constructor(client: Client);
|
|
/** Convenience for calling `condenser_api`. */
|
|
call(method: string, params?: any[] | {
|
|
[key: string]: any;
|
|
}): Promise<any>;
|
|
/**
|
|
* Get voting mana for an account.
|
|
*
|
|
* @param name Account name.
|
|
* @returns Current and maximum voting mana calculated from account vesting state.
|
|
*/
|
|
getAccountMana(name: string): Promise<{
|
|
current_mana: number;
|
|
max_mana: number;
|
|
}>;
|
|
/**
|
|
* Estimate the vote value for a post from mana, reward fund and chain properties.
|
|
*
|
|
* @param voteWeight Vote weight percentage.
|
|
* @param mana Current and maximum voting mana for the account.
|
|
* @param net_rshares Net rshares of the post.
|
|
* @param cashout_time Cashout time of the post in milliseconds.
|
|
* @param DGP Dynamic global properties.
|
|
* @param REWARD_FUND Reward fund data.
|
|
* @returns Estimated vote value rounded to three decimals.
|
|
*/
|
|
getAccountVoteValue(voteWeight: number, mana: {
|
|
current_mana: number;
|
|
max_mana: number;
|
|
}, net_rshares: string | number, cashout_time: number, DGP: DynamicGlobalProperties, REWARD_FUND: RewardFund): number;
|
|
/**
|
|
* Get the conversion of VESTS to BLURT.
|
|
* @param VESTS VESTS value.
|
|
* @param DGP Dynamic global properties from `condenser_api.get_dynamic_global_properties`.
|
|
*/
|
|
convertVESTS(VESTS: number, DGP: DynamicGlobalProperties): number;
|
|
serialize(serializer: Serializer, data: any): Buffer;
|
|
buildWitnessSetPropertiesOp(owner: string, props: WitnessSetProperties): WitnessSetPropertiesOperation;
|
|
}
|