Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marslavish opened this issue Feb 7, 2023 · 0 comments
Open

Comments

@marslavish
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant