-
Notifications
You must be signed in to change notification settings - Fork 130
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
base: main
Are you sure you want to change the base?
Conversation
dab21b5
to
a3aa991
Compare
apps/namadillo/src/App/Transactions/LocalStorageTransactionCard.tsx
Outdated
Show resolved
Hide resolved
apps/namadillo/src/App/Transactions/LocalStorageTransactionCard.tsx
Outdated
Show resolved
Hide resolved
Object.values(namadaAssetsMap.data).find((namadaAsset) => { | ||
// If the transaction asset has an address, try to match it directly | ||
if ( | ||
transaction.asset.symbol && |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
apps/namadillo/src/App/Transactions/LocalStorageTransactionCard.tsx
Outdated
Show resolved
Hide resolved
const getVoteTransactionInfo = ( | ||
tx: Tx["tx"] | ||
): VoteTransactionInfo | undefined => { | ||
if (!tx?.data) return undefined; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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);
2bfc6a5
to
047d21d
Compare
Closes #2146