-
Notifications
You must be signed in to change notification settings - Fork 8
SHARD-2738: Fix erc20 transaction information #94
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
urnotsam
wants to merge
11
commits into
dev
Choose a base branch
from
SHARD-2738-transactiondisplay-fixes
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dc2dc18
show all tokens
urnotsam 94d3491
null access fix
urnotsam 7c996a7
fix count of erc-20 tokens
urnotsam 87f320c
revert show all tokens change
urnotsam dc35d46
fix errors in conversion
urnotsam a009d55
fix all ethers versioning issues
urnotsam f422eac
change how erc20 interactions are displayed
urnotsam 57ae567
fix etheres on contract pages
urnotsam ea28877
fix more ethers issues
urnotsam 8d4551f
more ethers issues
urnotsam 7b874df
conversion fixes
urnotsam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,16 @@ export const Ovewview: React.FC<OvewviewProps> = ({ transaction }) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| const internalTxType = isInternalTx | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? transaction.wrappedEVMAccount?.readableReceipt?.internalTx?.internalTXType | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| : undefined | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check if this is an ERC20 transfer transaction | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const isERC20Transfer = transaction?.tokenTxs && | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| transaction.tokenTxs.length > 0 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| transaction.tokenTxs[0].tokenType === TokenType.ERC_20 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| (transaction.tokenTxs[0].tokenEvent === 'Transfer' || | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| transaction.tokenTxs[0].tokenEvent === 'Mint' || | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| transaction.tokenTxs[0].tokenEvent === 'Burn') | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| const primaryERC20Transfer = isERC20Transfer ? transaction.tokenTxs[0] : null | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const renderErc20Tokens = (): JSX.Element | undefined => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| const items = transaction?.tokenTxs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -65,7 +75,7 @@ export const Ovewview: React.FC<OvewviewProps> = ({ transaction }) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| <span>For</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div>{calculateTokenValue(item, item.tokenType, undefined, true)} </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Link href={`/account/${item.contractAddress}`} className={styles.anchor}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {item.tokenType === TokenType.EVM_Internal ? 'SHM' : item.contractInfo.name || item.contractAddress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {item.tokenType === TokenType.EVM_Internal ? 'SHM' : item.contractInfo?.name || item.contractAddress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Link> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ))} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -299,9 +309,23 @@ export const Ovewview: React.FC<OvewviewProps> = ({ transaction }) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.title}>To:</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.value}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {transaction?.wrappedEVMAccount?.readableReceipt?.to ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Link href={`/account/${transaction?.txTo}`} className={styles.link}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {transaction?.txTo} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Link> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| isERC20Transfer && primaryERC20Transfer ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Link href={`/account/${primaryERC20Transfer.tokenTo}`} className={styles.link}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {primaryERC20Transfer.tokenTo} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Link> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div style={{ fontSize: '0.8em', color: '#666', marginTop: '4px' }}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| via{' '} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Link href={`/account/${transaction?.txTo}`} className={styles.link}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {primaryERC20Transfer.contractInfo?.name || 'Token Contract'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Link> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Link href={`/account/${transaction?.txTo}`} className={styles.link}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {transaction?.txTo} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Link> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Link | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -375,7 +399,19 @@ export const Ovewview: React.FC<OvewviewProps> = ({ transaction }) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.item}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.title}>Value:</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className={styles.value}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {calculateFullValue(`${transaction?.wrappedEVMAccount?.readableReceipt?.value ?? 0}`)} SHM | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {isERC20Transfer && primaryERC20Transfer ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {calculateTokenValue(primaryERC20Transfer, primaryERC20Transfer.tokenType, undefined, true)}{' '} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {primaryERC20Transfer.contractInfo?.symbol || primaryERC20Transfer.contractAddress} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {transaction?.wrappedEVMAccount?.readableReceipt?.value !== '0x0' && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div style={{ fontSize: '0.8em', color: '#666', marginTop: '4px' }}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| + {calculateFullValue(`${transaction?.wrappedEVMAccount?.readableReceipt?.value ?? 0}`)} SHM | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| `${calculateFullValue(`${transaction?.wrappedEVMAccount?.readableReceipt?.value ?? 0}`)} SHM` | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+403
to
+414
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The check for
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Suggestion: Modifying
item.balancedirectly mutates the original token object, which can cause unintended side effects if the tokens array is reused elsewhere. Instead, create a new array with updated balances and avoid mutating the original objects. [general, importance: 7]