Skip to content

chore: add additional txn history types (Vote, Withdraw, Redelegate, Reveal PK) #2222

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

neocybereth
Copy link
Collaborator

@neocybereth neocybereth commented Jul 9, 2025

Closes #2146

@neocybereth
Copy link
Collaborator Author

neocybereth commented Jul 9, 2025

Screenshot 2025-07-10 at 11 47 31 AM Screenshot 2025-07-10 at 11 47 25 AM Screenshot 2025-07-10 at 12 04 48 PM

@neocybereth neocybereth changed the title chore: add additional txn history types (Vote, Withdraw, Redelegate) chore: add additional txn history types (Vote, Withdraw, Redelegate, Reveal PK) Jul 9, 2025
@neocybereth neocybereth force-pushed the chore/add-history-types branch from dab21b5 to a3aa991 Compare August 12, 2025 01:53
@neocybereth neocybereth requested review from mateuszjasiuk and removed request for mateuszjasiuk August 12, 2025 01:54
@neocybereth neocybereth requested review from mateuszjasiuk and removed request for mateuszjasiuk August 21, 2025 00:51
Object.values(namadaAssetsMap.data).find((namadaAsset) => {
// If the transaction asset has an address, try to match it directly
if (
transaction.asset.symbol &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: symbol is of type string do we check for empty string here? Or the type is misleading and it can be undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused on this one as empty string would be falsy anyway? Am I understanding the question correctly?

const getVoteTransactionInfo = (
tx: Tx["tx"]
): VoteTransactionInfo | undefined => {
if (!tx?.data) return undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to ask, is there any specific reason you explicitly return undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup so I just prefer the shorthand way of writing that over:

const getVoteTransactionInfo = (
  tx: Tx["tx"]
): VoteTransactionInfo  => {
  if (!tx?.data) return {
    proposalId: '',
    vote: '',
  };
  const parsed = typeof tx.data === "string" ? JSON.parse(tx.data) : tx.data;
  return {
    proposalId: parsed.id,
    vote: parsed.vote,
  };
};

That way when I use it here it's clear the parent is undefined without even having to check the children.

  const voteInfo = getVoteTransactionInfo(transaction);
  const proposalId =
    voteInfo?.proposalId && BigInt(voteInfo.proposalId);

@neocybereth neocybereth force-pushed the chore/add-history-types branch from 2bfc6a5 to 047d21d Compare August 22, 2025 00:11
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

Successfully merging this pull request may close these issues.

Tx history misses tx types
2 participants