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

bug report - Make TokenScript work on Dapp Browsers (ImToken & TrustWallet) #7109

Open
bobjiang opened this issue Apr 8, 2024 · 15 comments
Open
Assignees
Labels
Bug Something isn't working

Comments

@bobjiang
Copy link

bobjiang commented Apr 8, 2024

name: Bug Report
about: Using imToken, visit https://viewer.tokenscript.org/, click DAI stablecoin, and click convert to xDAI

this is a blocking issue, without fix it, we cannot list tokenscript viewer on imToken.


Describe the bug
blank page after click "convert to xDAI"

Steps to reproduce (REQUIRED)

video attached.

imToken-token-script-viewer.mp4

Expect
all pages are open correctly.

Observed
6b. ...

Screenshots
If applicable, screenshots (preferred to video) to help explain your problem, a wallet address or transaction hash if applicable/possible

Version or build number number
Version number (if app store), build number (if TestFlight)

Additional context (Error Messages, etc.)
Add any other context about the problem here.

@AW-STJ
Copy link

AW-STJ commented Apr 8, 2024

@abhishes007 - can you please check whether this is an issue in our iOS wallet or not?

@abhishes007
Copy link

The issue is observed only iOS - imToken Wallet

Workflow:

  • Open imToken wallet on iPhone device.
  • Click on Browser to visit browser inside the imToken wallet.
  • Enter URL : viewer.tokenscript.org
  • Click on Connect wallet button and select imToken wallet.
  • Click on DAI to navigate to DAI token and click on "Convert to xDAI"

Issue:

  • TS interface state is stuck on loading state for iOS - imToken wallet.
    The same flow shows the TS interface to convert on Android - imToken wallet.

Recordings:

iPhone - imToken App Version : 2.14.1.4651

iPhone-imToken-xDAIConverIssue.MP4

Android - imToken App Version: : 2.14.1.4651

Android-imToken-xDAIConverIssue.mp4

cc: @AW-STJ

@abhishes007 abhishes007 added the Bug Something isn't working label Apr 8, 2024
@bobjiang
Copy link
Author

@abhishes007
this bug should be in Trust Wallet iOS as well.

@micwallace you or others working on this?

@micwallace
Copy link

@bobjiang If newer tokenscript are loading (like smartcats) then it's likely some issue with these specific tokenscripts.

@abhishes007 When you get a chance can you confirm smartcats is working in Imtoken on iOS?

@abhishes007
Copy link

abhishes007 commented Apr 19, 2024

@micwallace I tried SmartCat actions and they seems to be stuck and same goes for CatKombat too.

iPhone-TS-imTokenBrowser-SCR-Issue.MP4

@AW-STJ
Copy link

AW-STJ commented Apr 19, 2024

I would say that xDAI TokenScript does not work as expected. It loads up even when there is no xDAI on wallet. And it does not work, hence this issue is flagged by both ImToken and TrustWallet. Its a very old TS that was developed by James Sangalli, we would need to change it and also investigate the behaviour to confirm that it works as expected.

Hence the things to correct:

  1. Make sure that the xDAI and ENS tokenscript are working fine
  2. Make sure that tokenscript is not loaded if there is no token on the wallet, only a demo token is loaded. Make sure that this is loaded on wallets with no wallets.
  3. Make sure that the CatKombat actions are working fine for both ImToken and TrustWallet.

https://www.loom.com/share/6ca4d452facc4f7f9bfffd68ddb3993f?sid=8a6450bf-62a2-4bad-b447-4b7c8c243b0d

@AW-STJ AW-STJ changed the title bug report - cannot load the "convert to xDAI" page for DAI stablecoin, during visit https://viewer.tokenscript.org/ bug report - Make TokenScript work on Dapp Browsers (ImToken & TrustWallet) Apr 19, 2024
@micwallace
Copy link

micwallace commented Apr 19, 2024

@abhishes007 @bobjiang Maybe this is to do with iframe srcdoc not working in iOS webview. The thing is that I change iframe from base64URL to srcdoc because base64URL did not work in Imtoken Android.

I will push an update to staging that uses base64URL on iOS only, but can't guarantee it will work.

@bobjiang Smartcats did work in iOS previously didn't it? If it did maybe this is something that has recently changed in TS engine

@micwallace
Copy link

@abhishes007 Do you know if there's a way to remote debug webviews on iOS? The browser console may have some clues to what is going on.

@abhishes007
Copy link

@micwallace, I am not sure of how we can access the console on iPhone for the browsers, also the browsers in question are inside the wallet (imToken, TrustWallet) apps which makes it more difficult. If you have any specific steps that I can try on my end then I will be happy to help and see if it works.

@micwallace
Copy link

@abhishes007 For imToken you can add a parameter to the URL to enable in-browser console: https://imtoken.gitbook.io/developers/products/webview

Although when I tried this on Android it wasn't working

@micwallace
Copy link

@abhishes007 If this doesn't work, let me know. I can probably install vconsole in TS viewer directly:
https://developer.trustwallet.com/developer/listing-new-dapps/debugging#id-3.-ios-safari-webview-debugging

@abhishes007
Copy link

@bobjiang I tried it on TrustWallet and for me the SmartCat actions as well as the xDAI TS screens seem to be loading well unless, I am missing something - Recording is attached.

iPhone-TrustWallet-TS-Working.MP4

@micwallace
Copy link

@bobjiang With help from Abishes we've narrowed down the problem to the browser not being able to load any srcdoc or blob content within the iframe.

It's likely that a setting on the imToken webview disallows loading of this content and we are unable to fix the issue on our end. It was a similar issue to Android but I was able to get around it by using srcdoc instead of blob content (which is a better better anyway). But in the iOS version srcdoc is also disabled.

To demonstrate the issue to imToken team, I've setup a simple page to test the various ways local content can be loaded within an iframe: https://viewer-staging.tokenscript.org/assets/iframe-local-src-test.html

Can you please reach out to imToken and ask them to enable srcdoc for their webview?
Tell them it is likely due to WKNavigationActionPolicy or originWhitelist not allowing this

@bobjiang
Copy link
Author

@bobjiang With help from Abishes we've narrowed down the problem to the browser not being able to load any srcdoc or blob content within the iframe.

It's likely that a setting on the imToken webview disallows loading of this content and we are unable to fix the issue on our end. It was a similar issue to Android but I was able to get around it by using srcdoc instead of blob content (which is a better better anyway). But in the iOS version srcdoc is also disabled.

To demonstrate the issue to imToken team, I've setup a simple page to test the various ways local content can be loaded within an iframe: https://viewer-staging.tokenscript.org/assets/iframe-local-src-test.html

Can you please reach out to imToken and ask them to enable srcdoc for their webview? Tell them it is likely due to WKNavigationActionPolicy or originWhitelist not allowing this

let me ping the imToken guys.

@AW-STJ
Copy link

AW-STJ commented May 6, 2024

@bobjiang - any updates from ImToken? Also were you able to reach out to them and move the listing conversations forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants