MetaMask / metamask-sdk

The simplest yet most secure way to connect your blockchain-based applications to millions of MetaMask Wallet users.
https://metamask.io/sdk/
Other
189 stars 118 forks source link

[Bug]: Async call fails to return to Dapp #979

Open muscleman opened 3 months ago

muscleman commented 3 months ago

SDK

Node.js

Provide environment information

works fine for me in Missouri, Does not work for my tester in St Louis or Poland

MetaMask SDK Version

0.27.0

MetaMask Mobile app Version

7.27.1 (1369)

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

pure js provided

Describe the Bug

the first call to approve a spending cap never returns execution back to the calling application.

So the next call to spend the allowance never gets called.

weird thing, when i run this it works. when my tester run this it doesn't return.

if they cancel the allowance/spend cap, execution returns to the app.

Expected Behavior

user can approve a spending cap, execution returns to my app and the user then approves my bridge to spend and burn the allowance.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/muscleman/web3-tester

To Reproduce

run tester app.

app invokes the following method. await tokenContract.methods.approve(this.bridge_address, web3.utils.toWei(1, "ether")).send({ from: tokenWalletAddress })

approve the spending cap in the mobile wallet

never returns execution in the app, no further code is executed.

when i run this locally, all works fine.

now, for me running the script, all works fine.

muscleman commented 3 months ago

You'll need to give me a test eth account and i'll send you some eXEQ tokens for testing

SimonPhoenix1985 commented 3 months ago

Same for me! On Android from Chrome mobile I am sending 'eth_sendTransaction' for spending cap and this Promise never resolves despite the fact that in Metamask app that transaction was successful.

muscleman commented 3 months ago

any updates on this @abretonc7s

SimonPhoenix1985 commented 3 months ago

I did some tests with cap. So:

muscleman commented 3 months ago

the tes app i provided is not using the browser. its javascript to metamask mobile wallet.

SimonPhoenix1985 commented 3 months ago

It doen't matter, app or mobile browser.

muscleman commented 3 months ago

and one of my testers is using iphone and it's not returning.

BigslimVdub commented 3 months ago

Can confirm not working on iOS latest MetaMask app 7.28.0 on ip13 pro and latest iOS 17.6.1. @SimonPhoenix1985 what iOS ver are you using? 17 includes some fun security features

SimonPhoenix1985 commented 3 months ago

Iphone 11, IOS 17.5.1, chrome mobile browser. In Metamask app after cap transaction I got "Go back to app" message and I have to go back manually, but Promise resolves.

SimonPhoenix1985 commented 3 months ago

@muscleman @BigslimVdub So, I think I've resolved the issue. In Metamask app->settings->advanced->smart transactions if this option is ON - it won't work, if you turn in OFF - Promise resolves

muscleman commented 3 months ago

actually on my iphone 14 this setting is on and it works for me european tester had his on and did not work

BigslimVdub commented 3 months ago

@muscleman @BigslimVdub So, I think I've resolved the issue. In Metamask app->settings->advanced->smart transactions if this option is ON - it won't work, if you turn in OFF - Promise resolves

Hmm I just tried this with smart transactions off and it worked first try, no issues or delays

SimonPhoenix1985 commented 3 months ago

But still there is a bug in Metamask app with smart transactions, it does not resolve Promise, need to be fixed

christopherferreira9 commented 1 week ago

Hi all! This may have been caused by smart transactions being enabled in all chains. Since 7.30, Smart transactions are only available on Mainnet currently so setting them ON or off should not have any effect. Can you please give this a try with the latest version of the MetaMask MObile Wallet?