Skip to content

[voting example] Decoded content didn't follow the same pattern #69

Open
@marslavish

Description

@marslavish

Get the decoded content

const { proposals } = await client.cosmos.gov.v1beta1.proposals({
  proposalStatus: ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED,
  depositor: '',
  voter: '',
});

const decodeUint8Arr = (uint8array: Uint8Array | undefined) => {
  if (!uint8array) return '';
  return new TextDecoder('utf-8').decode(uint8array);
};

for (const proposal of proposals) {
  console.log(decodeUint8Arr(proposal.content?.value));
}

Some decoded results
*Confirmation by CCN to agree to Unity Prop���This proposal signals that...
=Community Spend Proposal for Creation of Terra Developer Fund��!# Community Spend Proposal...
�Increase Validator Set to 150���# Increase Validator Set to 150...
QJuno on Osmosis - Early pool incentives to mitigate slippage and boost liquidity.���The core...
#MARS Airdrop for COSMOS holders ✅���According to tokenomics...
>Fair and Equitable Distribution of Remaining Funds (corrected)�� The multi-sig created by...

The pattern before and after the title aren't always the same so it makes it hard to extract the correct title and description at all times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions