fix decimal
This commit is contained in:
parent
7f4acfabe6
commit
e382913c19
@ -51,10 +51,6 @@ const typeMap = Object.fromEntries(
|
||||
Object.entries(MsgType).map(([k, v]) => ['/' + v, k])
|
||||
);
|
||||
|
||||
Object.assign(typeMap, {
|
||||
'/cosmos.params.v1beta1.ParameterChangeProposal': 'ParameterChangeProposal',
|
||||
});
|
||||
|
||||
const findType = (obj: any, type: string): any => {
|
||||
if (typeof obj !== 'object') return;
|
||||
const msg = obj[type];
|
||||
@ -66,9 +62,10 @@ const findType = (obj: any, type: string): any => {
|
||||
};
|
||||
|
||||
export const decodeProto = (msg: { typeUrl: string; value: Uint8Array }) => {
|
||||
const type = typeMap[msg.typeUrl];
|
||||
const type = typeMap[msg.typeUrl] ?? msg.typeUrl.split('.').pop();
|
||||
if (type) {
|
||||
const obj = findType(injProto, type);
|
||||
|
||||
if (obj) {
|
||||
const res = obj.decode(msg.value);
|
||||
if (res.msgs) {
|
||||
|
||||
@ -53,6 +53,8 @@ store.fetchProposal(props.proposal_id).then((res) => {
|
||||
proposalDetail.content!
|
||||
) as ParameterChangeProposal;
|
||||
Object.assign(proposalDetail.content!, changeProposal);
|
||||
// @ts-ignore
|
||||
delete proposalDetail.content.value;
|
||||
// when status under the voting, final_tally_result are no data, should request fetchTally
|
||||
if (proposalDetail.status === ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD) {
|
||||
// 'PROPOSAL_STATUS_VOTING_PERIOD') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user