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

Additional incoming transactions support #14219

Merged
merged 3 commits into from
Feb 14, 2023
Merged

Additional incoming transactions support #14219

merged 3 commits into from
Feb 14, 2023

Conversation

tgmichel
Copy link
Contributor

Currently only the built-in Infura networks - and not EVM compatible networks where the official Etherscan API is available - support displaying incoming transactions.

This PR proposes introducing additional support for them:

  • BNB Smart Chain - mainnet, testnet - view
  • Optimism - mainnet, testnet - view
  • Polygon - mainnet, testnet - view
  • Avalanche - mainnet, testnet - view
  • Fantom - mainnet, testnet - view
  • Moonbeam - mainnet, testnet - view
  • Moonriver - view

@tgmichel tgmichel requested a review from a team as a code owner March 28, 2022 08:16
@tgmichel tgmichel requested a review from PeterYinusa March 28, 2022 08:16
@github-actions
Copy link
Contributor

github-actions bot commented Mar 28, 2022

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@tgmichel
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@tgmichel
Copy link
Contributor Author

tgmichel commented Apr 5, 2022

@PeterYinusa did you have a chance to look at this?

@tgmichel
Copy link
Contributor Author

@PeterYinusa is there any additional work to do on my side to get it reviewed? Thank you.

@brad-decker
Copy link
Contributor

@tgmichel sorry we didn't review this yet, looks like a pretty amazing contribution that I'm sure our users would love. Could you do me a favor and rebase this? One area that has changed dramatically is the network.js constants file which is now typescript so you'll have to introduce some types to your changes. Let me know if you need assistance and tag me for review when you're ready :)

# Conflicts:
#	app/scripts/controllers/incoming-transactions.js
#	app/scripts/controllers/incoming-transactions.test.js
#	shared/constants/network.js
@tgmichel tgmichel dismissed a stale review via 5916f47 October 14, 2022 08:30
@tgmichel
Copy link
Contributor Author

@brad-decker Thank you, very excited to finally get this in :) and sorry it took a while, just rebased.

Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

Awesome work, we'll get more eyes on this next week for an additional approval.

brad-decker
brad-decker previously approved these changes Nov 7, 2022
Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

This LGTM, @seaona / @PeterYinusa I've tested this and it looks good locally, but i might miss some edge cases. Would either of you take a look from the QA side? @jpuri and/or @segun if you have a chance to do a code review that'd be great.

@seaona seaona added the needs-qa Label will automate into QA workspace label Nov 10, 2022
@seaona
Copy link
Contributor

seaona commented Nov 10, 2022

@brad-decker I can take a look

@seaona
Copy link
Contributor

seaona commented Nov 11, 2022

From QA looks good! @brad-decker @tgmichel ! I've only noticed one small behaviour on Polygon Testnet. Bascially, until I don't refresh the browser page I don't see any tx coming through. Not sure why I can only observe this on Polygon Testnet. Any ideas?

Just curious. I would still approve the PR from QA side, since after refreshing, the tx appear.

mumbai.mp4

@brad-decker
Copy link
Contributor

Thats peculiar. @seaona lets create a ticket to investigate that and i'll get another set of eyes on this.

@bschorchit bschorchit added team-confirmations-secure-ux DEPRECATED: please use "team-confirmations" label instead area-activity labels Nov 25, 2022
@tgmichel
Copy link
Contributor Author

tgmichel commented Dec 9, 2022

@brad-decker the issue @seaona mentioned doesn't seem to originate in this PR, is there something I can do to help you unlock it?

The logic for triggering _onLatestBlock and updating incomingTxLastFetchedBlockByChainId LGTM. I didn't debug it but it might be worth looking at getSelectedAddress here:

this._onLatestBlock = async (newBlockNumberHex) => {
    const selectedAddress = this.preferencesController.getSelectedAddress();
    const newBlockNumberDec = parseInt(newBlockNumberHex, 16);
    await this._update(selectedAddress, newBlockNumberDec);
};

If the selectedAddress is not properly retrieved from preferencesController, the _update function will early return:

if (
    !Object.hasOwnProperty.call(ETHERSCAN_SUPPORTED_NETWORKS, chainId) ||
    !address
) {
    return;
}

I'm thinking maybe after refreshing, the selectedAddress is correctly picked up and works as expected. Anyway this is just a wild guess because if that would happen shouldn't be something network-specific (and apparently is only observed in Polygon Testnet)

@chloeYue
Copy link
Contributor

Hello @tgmichel Thanks for your PR !
Do you think it's possible to add also incoming transactions for localhost with ganache ? Then it will help when we test locally.

@tgmichel
Copy link
Contributor Author

add also incoming transactions for localhost with ganache

The current controller for incoming transactions leverages Etherscan Api, which is not available for Ganache afaik.

@clydesdales
Copy link

@tgmichel
@brad-decker
@seaona
@PeterYinusa

Can i add a bounty to get this expedited? When will incoming transactions be merged? The community has been waiting far too long for such an essential feature to be added

@tgmichel
Copy link
Contributor Author

tgmichel commented Feb 8, 2023

@brad-decker sorry to come back at you again regarding this PR, please let me know when is ready to be merged so I can rebase once. Thank you!

@brad-decker
Copy link
Contributor

@tgmichel ready for merge, @pedronfigueiredo and I will get this merged once the rebase occurs

# Conflicts:
#	app/scripts/controllers/incoming-transactions.js
@tgmichel tgmichel dismissed stale reviews from pedronfigueiredo and brad-decker via 14d3b8c February 8, 2023 14:39
@tgmichel
Copy link
Contributor Author

tgmichel commented Feb 8, 2023

@brad-decker done

@brad-decker
Copy link
Contributor

@pedronfigueiredo when you come online please review and merge :D

@brad-decker brad-decker merged commit 3a00b5a into MetaMask:develop Feb 14, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-activity needs-qa Label will automate into QA workspace team-confirmations-secure-ux DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants