@provenanceio/wallet-utils
Version:
Typescript Utilities for Provenance Blockchain Wallet
21 lines (20 loc) • 633 B
JavaScript
import { govVoteOptions } from '../../../../utils';
/**
* Formats MsgVoteWeighted messages for display
* @param message of type MsgVoteWeighted
* @returns object with MsgVoteWeighted fields
*/
export var msgVoteWeighted = function msgVoteWeighted(message) {
return {
typeName: 'MsgVoteWeighted',
proposalId: message.getProposalId(),
voter: message.getVoter(),
optionsList: message.getOptionsList().map(function (item) {
return {
option: govVoteOptions[item.getOption()],
// Convert weight to a percent
weight: "".concat(Number(item.getWeight()) * 100, "%")
};
})
};
};