Skip to content

Commit

Permalink
bugfix/transactions filtering (#2365)
Browse files Browse the repository at this point in the history
* fix

* logic

* Revert "logic"

This reverts commit 413ee3a.
  • Loading branch information
estebanmino authored Mar 10, 2021
1 parent 9114b2c commit d5bc508
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
38 changes: 22 additions & 16 deletions app/components/Views/Asset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,34 +130,40 @@ class Asset extends PureComponent {
isTransfer,
transferInformation
} = tx;
if (isTransfer)
return this.props.tokens.find(
({ address }) => address.toLowerCase() === transferInformation.contractAddress.toLowerCase()
);
return (

const network = Engine.context.NetworkController.state.network;
if (
(safeToChecksumAddress(from) === selectedAddress || safeToChecksumAddress(to) === selectedAddress) &&
chainId === tx.networkID &&
(chainId === tx.chainId || (!tx.chainId && network === tx.networkID)) &&
tx.status !== 'unapproved'
);
) {
if (isTransfer)
return this.props.tokens.find(
({ address }) => address.toLowerCase() === transferInformation.contractAddress.toLowerCase()
);
return true;
}
return false;
};

noEthFilter = tx => {
const { chainId, swapsTransactions } = this.props;
const { chainId, swapsTransactions, selectedAddress } = this.props;
const {
transaction: { to, from },
isTransfer,
transferInformation
} = tx;
if (isTransfer) return this.navAddress === transferInformation.contractAddress.toLowerCase();
const network = Engine.context.NetworkController.state.network;
if (
(from?.toLowerCase() === this.navAddress || to?.toLowerCase() === this.navAddress) &&
chainId === tx.networkID &&
(safeToChecksumAddress(from) === selectedAddress || safeToChecksumAddress(to) === selectedAddress) &&
(chainId === tx.chainId || (!tx.chainId && network === tx.networkID)) &&
tx.status !== 'unapproved'
)
return true;
if (swapsTransactions[tx.id] && to?.toLowerCase() === SWAPS_CONTRACT_ADDRESS) {
const { destinationToken, sourceToken } = swapsTransactions[tx.id];
return destinationToken.address === this.navAddress || sourceToken.address === this.navAddress;
) {
if (isTransfer) return this.navAddress === transferInformation.contractAddress.toLowerCase();
if (swapsTransactions[tx.id] && to?.toLowerCase() === SWAPS_CONTRACT_ADDRESS) {
const { destinationToken, sourceToken } = swapsTransactions[tx.id];
return destinationToken.address === this.navAddress || sourceToken.address === this.navAddress;
}
}
return false;
};
Expand Down
15 changes: 9 additions & 6 deletions app/components/Views/TransactionsView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ const TransactionsView = ({
isTransfer,
transferInformation
} = tx;
if (isTransfer)
return tokens.find(
({ address }) => address.toLowerCase() === transferInformation.contractAddress.toLowerCase()
);
return (
if (
(safeToChecksumAddress(from) === selectedAddress || safeToChecksumAddress(to) === selectedAddress) &&
(chainId === tx.chainId || (!tx.chainId && network === tx.networkID)) &&
tx.status !== 'unapproved'
);
) {
if (isTransfer)
return tokens.find(
({ address }) => address.toLowerCase() === transferInformation.contractAddress.toLowerCase()
);
return true;
}
return false;
};

const submittedTxs = [];
Expand Down

0 comments on commit d5bc508

Please sign in to comment.