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

Issue with Polkadot.js Extension Integration for DApp Inside Iframe #1274

Open
AleemAlam opened this issue Jul 23, 2023 · 5 comments
Open

Issue with Polkadot.js Extension Integration for DApp Inside Iframe #1274

AleemAlam opened this issue Jul 23, 2023 · 5 comments

Comments

@AleemAlam
Copy link

Hi there,
I'm submitting a ...
✅ Feature request

I'm currently developing a DApp that renders within an iframe, and I encountered an issue with accessing the Polkadot.js extension. The DApp inside the iframe is unable to access the Polkadot.js extension, while it successfully accesses other extensions like MetaMask.

My goal is to enable the DApp inside the iframe to interact with the Polkadot.js extension to access Polkadot-based networks and perform transactions seamlessly.

Could you kindly guide how to achieve this functionality? Is there a specific approach or workaround that can allow the DApp inside the iframe to access the Polkadot.js extension successfully?

Thank you for your attention and assistance. I look forward to your valuable insights and solutions to resolve this issue.

Best regards,
Aleem Alam

@ankitShogun
Copy link

@AleemAlam I don't know if you are still facing this problem. I solved it using HTML5 message API. But you need to be in control of both the parent window and the iframe window as we need code changes on both sides.

@teodorus-nathaniel
Copy link

teodorus-nathaniel commented Nov 6, 2023

I also have the same problem, injectedWeb3 for polkadot.js extension was not passed to the iframe
while it have the wallets like talisman

@ankitShogun how did you do this? do you pass the injectedWeb3 value from the parent side using postMessage?

@ankitShogun
Copy link

ankitShogun commented Nov 7, 2023

@teodorus-nathaniel What i did was to create a sort of communication layer between iframe and the extension using the parent. Event based communication in short.
In general you need the extension for signing the transactions so whenever it was needed inside the dapp (iframe), it will post a request message to parent with the required data.
Parent will take that data, sign that using polkadot extension and then fire back an event targeting the iframe with the signed data.
Not sure if passing the injectedWeb3 will work as you need the UI feedback of polkadot extension while signing the message.

@swdreams
Copy link

swdreams commented Nov 9, 2023

@ankitShogun is there any example code on how to communicate between iframe and parent?

@mw2000
Copy link

mw2000 commented Feb 8, 2024

@jacogr i'd love to help contribute to this feature if it could be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants