@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
47 lines • 1.96 kB
TypeScript
import { BigNumber } from "bignumber.js";
import type { SuperRepresentative, TronAccount, Vote } from "@ledgerhq/coin-tron/types/index";
export type Action = {
type: "updateVote" | "resetVotes" | "clearVotes";
address: string;
value: string;
};
export type State = {
votes: Record<string, number>;
votesAvailable: number;
votesUsed: number;
votesSelected: number;
max: number;
initialVotes: Record<string, number>;
};
export declare const MIN_TRANSACTION_AMOUNT: BigNumber;
export declare const SR_THRESHOLD = 27;
export declare const SR_MAX_VOTES = 5;
/** Fetch the list of super representatives */
export declare const useTronSuperRepresentatives: () => Array<SuperRepresentative>;
/** Get last time voted */
export declare const getLastVotedDate: (account: TronAccount) => Date | null | undefined;
/** Get next available date to claim rewards */
export declare const getNextRewardDate: (account: TronAccount) => number | null | undefined;
/** format votes with superrepresentatives data */
export declare const formatVotes: (votes: Array<Vote> | null | undefined, superRepresentatives: Array<SuperRepresentative> | null | undefined) => Array<Vote & {
validator?: SuperRepresentative | null;
isSR: boolean;
rank: number;
}>;
export declare function useTronPowerLoading(account: TronAccount): boolean;
/** Hook to search and sort SR list according to initial votes and query */
export declare function useSortedSr(search: string, superRepresentatives: SuperRepresentative[], votes: Vote[]): {
sr: SuperRepresentative;
name: string | null | undefined;
address: string;
rank: number;
isSR: boolean;
}[];
/** format account to retrieve unfreeze data */
export declare const getUnfreezeData: (account: TronAccount) => {
unfreezeBandwidth: BigNumber;
unfreezeEnergy: BigNumber;
canUnfreezeBandwidth: boolean;
canUnfreezeEnergy: boolean;
};
//# sourceMappingURL=react.d.ts.map