BuidlGuidl / burnerwallet

https://burner.buidlguidl.com
MIT License
0 stars 1 forks source link

Integrate WalletConnect with pending TODOs #46

Closed damianmarti closed 1 month ago

damianmarti commented 1 month ago

This PR integrates WalletConnect.

It allows you to send transactions, sign messages, and sign typed data. The code to sign transactions is implemented but needs testing.

You can scan a WalletConnect QR code and the WalletConnectDrawer should appear with a Connect button.

When you are connected to the dapp, if you send a transaction or sign a message, you should see a confirmation window on the BurnerWallet.

There are a lot of improvements to do. I left some TODOs on the code.

  1. Improve confirmations and how the transaction and sign data is shown. We can still improve it
  2. Allow to change networks after paired with the dapp
  3. Test signing transactions
  4. Save session information on LocalStorage to allow it to keep it working after a reload.
  5. Add an indicator showing connected to a dapp (and disconnect button).
  6. Maybe add a setting to auto-confirm transactions and signing.
  7. Test it a lot, sometimes weird behavior happens.
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated (UTC)
burnerwallet-nextjs โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jun 4, 2024 1:26pm
damianmarti commented 1 month ago

When I scan a WalletConnect QR, I get this log:

Scan result wc:e126ce495a12b3a24e14811979d0eb5bb8ca30eb01e68ef9e134e6e69e13820e@2?relay-protocol=irn&symKey=dfee7d4f5899b874c84e282ccaae8bc14ba8d47c255985428f1c635de09a534d

But it stays in the loading screen, and nothing happends in the original device who was trying to connect via WalletConnect.

image

  • Burner wallet in desktop (win10)
  • QR code generated in android mobile (trying to connect to different dapps, uniswap, aave, se-2-challenge)

Trying to reproduce the opposite use case, scanning with burner in mobile, to a generated QR in desktop, but having problems to allow camera in a local url, will report back soon ๐Ÿ™Œ

Thanks for testing @Pabl0cks !!

Sorry, I forgot to mention that if you want to test it locally you have to add NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID to your .env file. You can get a project id from https://cloud.walletconnect.com/

damianmarti commented 1 month ago

Thanks @Pabl0cks for all the testing!!

I will use the same dapps and fix the issues.

Here is the result of the first tests:

SRE Challenge 3 in sepolia results

  • Link
  • When I accept the connection after scanning the QR, I get this error in console: GET https://verify.walletconnect.com/attestation/ea88b0c7348af349e22f36fcd94e9be0d9af79c5c136d0cc1fcb0fc2bae049cb 404 (Not Found)
  • Then when I try to do an action in the dapp, after accepting the confirm in the burner wallet, I get this error:
index.es.js:90 
 GET https://verify.walletconnect.com/attestation/d941aa4โ€ฆ net::ERR_ABORTED 404 (Not Found)
WalletConnectDrawer.tsx:169 
 POST http://127.0.0.1:8545/ net::ERR_CONNECTION_REFUSED
WalletConnectDrawer.tsx:177 TransactionExecutionError: HTTP request failed.

URL: http://127.0.0.1:8545
Request body: {"method":"eth_chainId"}

Request Arguments:
  from:   0x1dC580f680120c2A913C972d45AE7C5307669611
  to:     0xa0feC4b3C544e20cC805FAF988Fad885b64Df86D
  value:  0.002 ETH
  data:   0x7d789dee

Details: Failed to fetch
Version: viem@1.19.9
    at getTransactionError (getTransactionError.js:18:12)
    at sendTransaction (sendTransaction.js:138:105)
    at async o.onSessionRequest (WalletConnectDrawer.tsx:169:28)

Matcha results

  • Link
  • When I try to scan the QR code from Matcha, it is not able not read it. Perhaps is their chat icon at the bottom right. Maybe it would be nice to have a fallback method to link the burnerwallet for those cases, pasting the link manually? image

Yes, I had this feature for testing, I will add this in some way.

Uniswap results

  • Link
  • Scan works, but after scanning I get an error in the mobile device I'm trying to connect, and I get errors in the burnerwallet
  • Console error: index.es.js:90 GET https://verify.walletconnect.com/attestation/1c9166e79df9543a0d8b2426056c45cbec885bd9c10dc78437c5bb88ef0127ad 404 (Not Found) image image

This issue happened because the wallet is on Sepolia and Uniswap is using mainnet. Allowing network switching is a pending feature. Please try setting the burnetwallet to mainnet before connecting to Uniswap. I tried it on Optimism before and it worked, and I made a swap successfully.

Opensea testnet results

  • Link
  • Scan works, but after scanning I get a confirm in burnerwallet that I accept, but keeps popping, and the site does not connect.
  • Console warning: MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 disconnect listeners added. Use emitter.setMaxListeners() to increase limit image

I think that something was in a wrong state because of a bug before connecting to OpenSea. I will check this.

Thanks!!

Pabl0cks commented 1 month ago

This issue happened because the wallet is on Sepolia and Uniswap is using mainnet. Allowing network switching is a pending feature. Please try setting the burnetwallet to mainnet before connecting to Uniswap. I tried it on Optimism before and it worked, and I made a swap successfully.

Thank you! Linked perfectly connecting to OP mainnet, sorry!

damianmarti commented 1 month ago

This issue happened because the wallet is on Sepolia and Uniswap is using mainnet. Allowing network switching is a pending feature. Please try setting the burnetwallet to mainnet before connecting to Uniswap. I tried it on Optimism before and it worked, and I made a swap successfully.

Thank you! Linked perfectly connecting to OP mainnet, sorry!

@Pabl0cks I fixed a bug and now you should be able to connect to any of the sites you tested before. Please try again and let me know if there is any issue. Take into account that you have to be on the same network before trying to connect. I'm working now on adding the feature to be able to switch networks after connecting.

I added a way to add an address or a WalletConnect UID. You have a button to switch when trying to scan.

Thanks!!

damianmarti commented 1 month ago

@Pabl0cks Added support to switch network. When you are trying to send a transaction not in the current network, it will detect and ask if you want to switch to that network.

Pabl0cks commented 1 month ago

@Pabl0cks Added support to switch network. When you are trying to send a transaction not in the current network, it will detect and ask if you want to switch to that network.

Edit: This problem is happening in burnerwallet with Chrome, with Brave it's working nice, will continue testing there.

With last changes I'm able to connect to all the sites that I'm trying, but I'm having problems signing transactions. I interact with dapps but the signing confirm is never appearing in my burnerwallet.

I'm getting these error in burnerwallet console:

GET https://verify.walletconnect.com/attestation/ee0058351d0eda9308524223cdc39338d962f374c39e2e4c6d1a7db1b4afaf62 404 (Not Found)

GET https://verify.walletconnect.com/attestation/2291c28aab66cfe9799c6144fee423fc9de979339a93e81dd68d29b5d633a383 net::ERR_ABORTED 404 (Not Found)
damianmarti commented 1 month ago

@Pabl0cks Added support to switch network. When you are trying to send a transaction not in the current network, it will detect and ask if you want to switch to that network.

With last changes I'm able to connect to all the sites that I'm trying, but I'm having problems signing transactions. I interact with dapps but the signing confirm is never appearing in my burnerwallet.

I'm getting these error in burnerwallet console:

GET https://verify.walletconnect.com/attestation/ee0058351d0eda9308524223cdc39338d962f374c39e2e4c6d1a7db1b4afaf62 404 (Not Found)

GET https://verify.walletconnect.com/attestation/2291c28aab66cfe9799c6144fee423fc9de979339a93e81dd68d29b5d633a383 net::ERR_ABORTED 404 (Not Found)

Don't care about these attestations errors, at least for now.

The confirm will not appear (blocked by the browser) if the burner wallet browser tab is not the active one. Maybe this is the issue. Anyway, I'm working on removing the javascript confirm with something better.

damianmarti commented 1 month ago

@Pabl0cks Added support to switch network. When you are trying to send a transaction not in the current network, it will detect and ask if you want to switch to that network.

Edit: This problem is happening in burnerwallet with Chrome, with Brave it's working nice, will continue testing there.

With last changes I'm able to connect to all the sites that I'm trying, but I'm having problems signing transactions. I interact with dapps but the signing confirm is never appearing in my burnerwallet.

I'm getting these error in burnerwallet console:

GET https://verify.walletconnect.com/attestation/ee0058351d0eda9308524223cdc39338d962f374c39e2e4c6d1a7db1b4afaf62 404 (Not Found)

GET https://verify.walletconnect.com/attestation/2291c28aab66cfe9799c6144fee423fc9de979339a93e81dd68d29b5d633a383 net::ERR_ABORTED 404 (Not Found)

@Pabl0cks Oh, I read the note, I think the issue with Chrome is the one from my previous comment.

Pabl0cks commented 1 month ago

Thanks for the quick responses Damu!

I did some testing signing transactions, here are some issues I faced (tried the dapps in that particular order):

1. testnets.opensea.io - [Link](https://testnets.opensea.io/account) - Linked to burner OK and signed message OK - When I tried to list a challenge 0 NFT I had in the account, signing the transaction to approve the collection I got this: ``` URL: https://eth-sepolia.g.alchemy.com/v2/oKxs-03sij-U_N0iOlrSsZFr29-IqbuF Request body: {"method":"eth_sendRawTransaction","params":["0x02f8b683aa36a70d843b9aca0084c0b69c518630786561326494ddfcc62c6194e9fb99af54660fb1a79b77e81b3280b844a22cb4650000000000000000000000001e0049783f008a0085193e00003d00cd54003c710000000000000000000000000000000000000000000000000000000000000001c080a01a1ed644d7848c61d285411a467b2283dedb2af084f9812a8a1881a051f9fb38a073f13af1048e8502ed7227952b161f7c4a739fa1c19103539e724fdf952ceef9"]} Request Arguments: from: 0x1dC580f680120c2A913C972d45AE7C5307669611 to: 0xddfcc62c6194e9fb99af54660fb1a79b77e81b32 value: 0 ETH data: 0xa22cb4650000000000000000000000001e0049783f008a0085193e00003d00cd54003c710000000000000000000000000000000000000000000000000000000000000001 gas: 0xea2d Details: exceeds block gas limit Version: viem@1.19.9 at getTransactionError (getTransactionError.js:18:12) at sendTransaction (sendTransaction.js:138:105) at async o.onSessionRequest (WalletConnectDrawer.tsx:219:28) ```
2. Token vendor - [Link](https://project02-emres-projects-ba2fe695.vercel.app/token-vendor) - Links OK to burner - Go to "Token vendor" tab - Try to buy 0.01 tokens - 4 popups appear to confirm in burner - I get this error: ``` WalletConnectDrawer.tsx:227 TransactionExecutionError: Nonce provided for the transaction is lower than the current nonce of the account. Try increasing the nonce or find the latest nonce with getTransactionCount. Request Arguments: from: 0x1dC580f680120c2A913C972d45AE7C5307669611 to: 0xcA057d31fac0c180E1370788E051aDd24da7CADa value: 0.001 ETH data: 0xd0febe4c Details: already known Version: viem@1.19.9 at getTransactionError (getTransactionError.js:18:12) at sendTransaction (sendTransaction.js:138:105) at async o.onSessionRequest (WalletConnectDrawer.tsx:219:28) ```
3. Dex challenge - [Link](https://project04-emres-projects-ba2fe695.vercel.app/dex) - Linked OK but I got this msg in the console: `MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 disconnect listeners added. Use emitter.setMaxListeners() to increase limit` - Go to DEX tab - Try to swapp 0.001 ETH - 9 popups appear to confirm in burner - I get this error: ``` WalletConnectDrawer.tsx:227 TransactionExecutionError: Nonce provided for the transaction is lower than the current nonce of the account. Try increasing the nonce or find the latest nonce with getTransactionCount. Request Arguments: from: 0x1dC580f680120c2A913C972d45AE7C5307669611 to: 0xbC27C580BeAfBF715C999019AeE579c104e4741a value: 0.001 ETH data: 0x789770f4 Details: already known Version: viem@1.19.9 at getTransactionError (getTransactionError.js:18:12) at sendTransaction (sendTransaction.js:138:105) at async o.onSessionRequest (WalletConnectDrawer.tsx:219:28) ```
damianmarti commented 1 month ago

Thanks for the quick responses Damu!

I did some testing signing transactions, here are some issues I faced (tried the dapps in that particular order):

  1. testnets.opensea.io
  2. Token vendor
  3. Dex challenge

@Pabl0cks thanks for testing!!

There was a bug with the gas parameter sent when using OpenSea. Now it's fixed.

Token vendor and Dex challenge worked ok. Something got corrupter after you got the OpenSea error and because of that, you got the error on the other sites. I will investigate how can I keep things working after an error like that.

I improved the confirmation window. Now it's a modal. This can be improved, but now it's a better starting point :-)

I will keep fixing bugs and adding/improving features!

Pabl0cks commented 1 month ago

Now is working much better @damianmarti, TY!!

I'm still facing some issues, but some are being hard to reproduce, they seem to appear "randomly".

Will continue testing during the weekend and try to send a report with the issues, hopefully with a way to reproduce them!

Pabl0cks commented 1 month ago

A small report of the issues I faced in the last tests:

Still some random errors I got when trying to fire a transaction in dapp and does not propagate to burner, but today they did not happen ("Request expired. Please try again", "Cannot Connect to account"). They seemed like random disconnections, if they happen again will document the pattern if I detect it.

damianmarti commented 1 month ago

A small report of the issues I faced in the last tests:

  • Switch network.

    • When you need to switch network because burner is not connected to the dapp network, burner asks you more than one time (today it asked 4 times in the first dapp I needed to switch, and 2 times the second dapp).
    • After you switch network, sign the transaction, and tx finishes, the next transactions you fire, keep asking to switch network, when you are already in that network in burner. Some cache seems to not refresh ok.
  • Disconnect the connected account in your dapp doesn't seem to propagate changes directly to burner, you need to refresh burner to make it disconnect correctly. (If you try to connect to other dapp before refreshing burner, it shows the "Disconnect" button in burner, even you are not really connected.
  • When you refresh your dapp with CTRL+R (should not work yet since I think it's in TODO list), but it seems to break the Walletconnect option from rainbow, I try to connect later to that dapp, and clicking on Walletconnect option does nothing.
  • From time to time, when you leave burnerwallet for a few minutes with no use, you were connected to a dapp and try to connect to a new one, Disconnect takes a while to respond (seems like is not working and you click it more times thinking you did not click), and all the disconnect messages appear at once after waiting for 15-20 seconds.
  • Would be cool to make connecting to new dapps more smooth, like if you were connected to another Dapp, make the action to fire the disconnect+connect at the same time, changing a bit the prompt + button CTA (to skip the double scan to first disconnect and then connect)
  • Awaiting for user confirmation doesn't leave when the transaction is already confirmed. This only happened to me at some point today in the token-vendor challenge, and kept happening after that only for this dapp. The next dapp I tried it was working fine.

Still some random errors I got when trying to fire a transaction in dapp and does not propagate to burner, but today they did not happen ("Request expired. Please try again", "Cannot Connect to account"). They seemed like random disconnections, if they happen again will document the pattern if I detect it.

@Pabl0cks Thanks for all the testing!!! I will review all these comments and try to fix/improve all these items!

Yeah, the random errors are hard :-(

damianmarti commented 1 month ago

@Pabl0cks I made a lot of improvements connecting, disconnecting, and changing the network.

More information between your comments:

A small report of the issues I faced in the last tests:

  • Switch network.

    • When you need to switch network because burner is not connected to the dapp network, burner asks you more than one time (today it asked 4 times in the first dapp I needed to switch, and 2 times the second dapp).

Fixed!

  • After you switch network, sign the transaction, and tx finishes, the next transactions you fire, keep asking to switch network, when you are already in that network in burner. Some cache seems to not refresh ok.

Fixed!

  • Disconnect the connected account in your dapp doesn't seem to propagate changes directly to burner, you need to refresh burner to make it disconnect correctly. (If you try to connect to other dapp before refreshing burner, it shows the "Disconnect" button in burner, even you are not really connected.

Fixed!

  • When you refresh your dapp with CTRL+R (should not work yet since I think it's in TODO list), but it seems to break the Walletconnect option from rainbow, I try to connect later to that dapp, and clicking on Walletconnect option does nothing.

Pending issue. It works ok on Uniswap but not on Challenge 4 dapp. I'm not sure if it's something related to the burnerwallet code or SE-2 code, we have to test more dapps.

  • From time to time, when you leave burnerwallet for a few minutes with no use, you were connected to a dapp and try to connect to a new one, Disconnect takes a while to respond (seems like is not working and you click it more times thinking you did not click), and all the disconnect messages appear at once after waiting for 15-20 seconds.

Fixed. Now the disconnect gets disabled until the disconnect action finishes.

  • Would be cool to make connecting to new dapps more smooth, like if you were connected to another Dapp, make the action to fire the disconnect+connect at the same time, changing a bit the prompt + button CTA (to skip the double scan to first disconnect and then connect)

Now when you try to connect to a new dapp and you are already connected to another one, you will see a button to do this in one step Disconnect and Connect to new Dapp

  • Awaiting for user confirmation doesn't leave when the transaction is already confirmed. This only happened to me at some point today in the token-vendor challenge, and kept happening after that only for this dapp. The next dapp I tried it was working fine.

Can't reproduce it. We need to keep testing and fix these corner cases.

Still some random errors I got when trying to fire a transaction in dapp and does not propagate to burner, but today they did not happen ("Request expired. Please try again", "Cannot Connect to account"). They seemed like random disconnections, if they happen again will document the pattern if I detect it.

Yeah, we have to keep testing! Thanks for all the hard testing!!!

Pabl0cks commented 1 month ago

@Pabl0cks I made a lot of improvements connecting, disconnecting, and changing the network.

TYSM Damu! It definitely feels much smoother when connecting / disconnecting with last changes.

Disconnect the connected account in your dapp doesn't seem to propagate changes directly to burner, you need to refresh burner to make it disconnect correctly. (If you try to connect to other dapp before refreshing burner, it shows the "Disconnect" button in burner, even you are not really connected.

This one didn't work for me yet. I still have to refresh burnerwallet after disconnecting from Dapp to see it disconnected, before manually refreshing after disconnect from dapp:

Other disconnect/connect issues I found in the last tests:

I'll keep testing ๐Ÿ™Œ

damianmarti commented 1 month ago

Thanks @Pabl0cks for keep testing it!!

@Pabl0cks I made a lot of improvements connecting, disconnecting, and changing the network.

TYSM Damu! It definitely feels much smoother when connecting / disconnecting with last changes.

:-)

Disconnect the connected account in your dapp doesn't seem to propagate changes directly to burner, you need to refresh burner to make it disconnect correctly. (If you try to connect to other dapp before refreshing burner, it shows the "Disconnect" button in burner, even you are not really connected.

This one didn't work for me yet. I still have to refresh burnerwallet after disconnecting from Dapp to see it disconnected, before manually refreshing after disconnect from dapp:

  • I still see the WC icon next to the chain dropdown
  • When I try to connect to a new dapp, I see the Disconnect + Connect button instead of just connect.
  • If I try to hit that "Disconnect + Connect" I get an error, I suppose because I'm not really connected to the old dapp. `Error: Missing or invalid. Record was recently deleted - session: 67d7d2c4d46c1d5f8935be6cef2724df9d5fa251ad23c1e824ccd6d5388d839eยด

Sorry, working now!

Other disconnect/connect issues I found in the last tests:

  • Not showing the network change alert on burnerwallet (yesterday other use cases were working fine, showing the change network popup). Steps to reproduce:

    1. I got burnerwallet connected to Ethereum network
    2. I open Chal 0 dapp (https://collectible-beta.vercel.app/) and Connect via WC with burnerwallet
    3. I go to "My NFTs" tab and click "Mint NFT".
    4. I get "User rejected network switch" message, without getting any popup in the burnerwallet

It worked for me.

  • When connecting to blur.io (I had my burner with Sepolia chain), i get like 8 change network alert pops before it shows the Sign message popup.

I only got one network change alert, then the sign message and it worked.

  • When I disconnect in the burnerwallet by clicking the option in the WC icon, it works OK if i don't have the dapp in an active tab, when I activate the dapp (other screen) I see it disconnected, but if I have the dapp opened in an active tab (other screen), it keeps connected, and I can continue to fire transactions.

  • If I try the above use case with blur.io, it does not work even if I got it opened in an active tab from other screen. And when I disconnect it manually from blur.io, I try to connect again, but I get a "Loading" button in the WalletConnect drawer from burner, instead a "Connect dapp" button. If I refresh burner, and try to connect again, I get the "Connect dapp" button normally.

I tried it having the tab active or not, on both sites, and it worked ok.

I didn't get any of these errors. Everything seems to be working fine. Maybe there was an error before and then these actions were wrong.

I will keep trying to reproduce these errors.

I'll keep testing ๐Ÿ™Œ

Thanks!!!

damianmarti commented 1 month ago

Thanks @Pabl0cks for keep testing it!!

@Pabl0cks I made a lot of improvements connecting, disconnecting, and changing the network.

TYSM Damu! It definitely feels much smoother when connecting / disconnecting with last changes.

:-)

Disconnect the connected account in your dapp doesn't seem to propagate changes directly to burner, you need to refresh burner to make it disconnect correctly. (If you try to connect to other dapp before refreshing burner, it shows the "Disconnect" button in burner, even you are not really connected.

This one didn't work for me yet. I still have to refresh burnerwallet after disconnecting from Dapp to see it disconnected, before manually refreshing after disconnect from dapp:

  • I still see the WC icon next to the chain dropdown
  • When I try to connect to a new dapp, I see the Disconnect + Connect button instead of just connect.
  • If I try to hit that "Disconnect + Connect" I get an error, I suppose because I'm not really connected to the old dapp. `Error: Missing or invalid. Record was recently deleted - session: 67d7d2c4d46c1d5f8935be6cef2724df9d5fa251ad23c1e824ccd6d5388d839eยด

Sorry, working now!

Other disconnect/connect issues I found in the last tests:

  • Not showing the network change alert on burnerwallet (yesterday other use cases were working fine, showing the change network popup). Steps to reproduce:

    1. I got burnerwallet connected to Ethereum network
    2. I open Chal 0 dapp (https://collectible-beta.vercel.app/) and Connect via WC with burnerwallet
    3. I go to "My NFTs" tab and click "Mint NFT".
    4. I get "User rejected network switch" message, without getting any popup in the burnerwallet

It worked for me.

  • When connecting to blur.io (I had my burner with Sepolia chain), i get like 8 change network alert pops before it shows the Sign message popup.

I only got one network change alert, then the sign message and it worked.

  • When I disconnect in the burnerwallet by clicking the option in the WC icon, it works OK if i don't have the dapp in an active tab, when I activate the dapp (other screen) I see it disconnected, but if I have the dapp opened in an active tab (other screen), it keeps connected, and I can continue to fire transactions.

  • If I try the above use case with blur.io, it does not work even if I got it opened in an active tab from other screen. And when I disconnect it manually from blur.io, I try to connect again, but I get a "Loading" button in the WalletConnect drawer from burner, instead a "Connect dapp" button. If I refresh burner, and try to connect again, I get the "Connect dapp" button normally.

I tried it having the tab active or not, on both sites, and it worked ok.

I didn't get any of these errors. Everything seems to be working fine. Maybe there was an error before and then these actions were wrong.

I will keep trying to reproduce these errors.

I'll keep testing ๐Ÿ™Œ

Thanks!!!

@Pabl0cks now I'm getting the multiple switch network alerts, it seems related to some previous error. I will debug it!!

Pabl0cks commented 1 month ago

Other disconnect/connect issues I found in the last tests:

Not showing the network change alert on burnerwallet (yesterday other use cases were working fine, showing the change network popup). Steps to reproduce:

I got burnerwallet connected to Ethereum network I open Chal 0 dapp (https://collectible-beta.vercel.app/) and Connect via WC with burnerwallet I go to "My NFTs" tab and click "Mint NFT". I get "User rejected network switch" message, without getting any popup in the burnerwallet

It worked for me.

It kept failing me in Brave, but working in Firefox. Disconnected from dapp in Brave, then reconnected, and now is sending the tx nicely ๐Ÿ™Œ

Disconnect the connected account in your dapp doesn't seem to propagate changes directly to burner, you need to refresh burner to make it disconnect correctly. (If you try to connect to other dapp before refreshing burner, it shows the "Disconnect" button in burner, even you are not really connected.

Sorry, working now!

Thanks! Working now. The "Disconnected from WalletConnect" messages start duplicating after first disconnect. For example:

Maybe is related with the multiple switch network alerts.

damianmarti commented 1 month ago

Other disconnect/connect issues I found in the last tests: Not showing the network change alert on burnerwallet (yesterday other use cases were working fine, showing the change network popup). Steps to reproduce: I got burnerwallet connected to Ethereum network I open Chal 0 dapp (https://collectible-beta.vercel.app/) and Connect via WC with burnerwallet I go to "My NFTs" tab and click "Mint NFT". I get "User rejected network switch" message, without getting any popup in the burnerwallet

It worked for me.

It kept failing me in Brave, but working in Firefox. Disconnected from dapp in Brave, then reconnected, and now is sending the tx nicely ๐Ÿ™Œ

Disconnect the connected account in your dapp doesn't seem to propagate changes directly to burner, you need to refresh burner to make it disconnect correctly. (If you try to connect to other dapp before refreshing burner, it shows the "Disconnect" button in burner, even you are not really connected.

Sorry, working now!

Thanks! Working now. The "Disconnected from WalletConnect" messages start duplicating after first disconnect. For example:

Maybe is related with the multiple switch network alerts.

It should be working fine now!! The multiple switch networks should be fixed too.

Anyway, I will keep testing!

Pabl0cks commented 1 month ago

It should be working fine now!! The multiple switch networks should be fixed too.

Both disconnect and switch network only showing 1 message not for me, Thank you!

Pabl0cks commented 1 month ago

After last tests, I found these issues:

damianmarti commented 1 month ago

After last tests, I found these issues:

  • Now when I disconnect from burner, it doesn't propagate to the dapp. In the dapp I get this console error:
    Uncaught (in promise) SwitchChainError
      at tE.switchChain (6973-bbcb1d9123eac5c5.js:68:5251)
      at async tE.getProvider (6973-bbcb1d9123eac5c5.js:68:4002)
      at async Promise.all (/index 0)
      at async tE.getWalletClient (6973-bbcb1d9123eac5c5.js:68:4092)
      at async eo (6973-bbcb1d9123eac5c5.js:71:11396)
      at async n (6973-bbcb1d9123eac5c5.js:71:11744)Caused by: TypeError: Cannot set properties of undefined (setting 'defaultChain')
      at cp.onChainChanged (1482.d1dae5cb5008ff78.js:75:29307)
      at o.<anonymous> (1482.d1dae5cb5008ff78.js:75:28047)
      at o.emit (2421-73e9c077238b2845.js:1:87232)
      at u4.setDefaultChain (1482.d1dae5cb5008ff78.js:75:10482)
      at u4.handleSwitchChain (1482.d1dae5cb5008ff78.js:75:11732)
      at u4.request (1482.d1dae5cb5008ff78.js:75:10092)
      at cp.request (1482.d1dae5cb5008ff78.js:75:22536)
      at cx.request (1482.d1dae5cb5008ff78.js:75:31536)
      at tE.switchChain (6973-bbcb1d9123eac5c5.js:68:5062)
      at async tE.getProvider (6973-bbcb1d9123eac5c5.js:68:4002)

The disconnect issue is fixed now. I had to update walletconnect/web3wallet to 1.12.1 because I was receiving the session_proposal event twice. After updating it's working ok, but the web3wallet takes a couple of seconds to initialize (I don't know why, with the previous version it was a lot faster). I added an initialized flag to avoid trying to connect to a dapp before the web3wallet is initialized. I will try to figure out why the web3wallet takes a lot of time to initialize.

  • If you close the WC modal in the dapp (the one that lets you copy the code), it says "Connected" when you click "Connect Dapp" in the burner, but it doesn't really connect. In the dapp I get this console error:
    Error: Connection request reset. Please try again.
    at 3441.f43d0bf9f3fe04d7.js:40:33700
    at 5318.50d80505945cd5ea.js:1:10628
    at 5318.50d80505945cd5ea.js:1:3336
    window.console.error @ 7023-0f706cc01d74f57c.js:1
    7023-0f706cc01d74f57c.js:1 {time: 1717059677525, level: 50, context: 'core/pairing'}
    window.console.error @ 7023-0f706cc01d74f57c.js:1
    forwardToConsole @ 3441.f43d0bf9f3fe04d7.js:14
    appendToLogs @ 3441.f43d0bf9f3fe04d7.js:14
    write @ 3441.f43d0bf9f3fe04d7.js:14
    write @ 3441.f43d0bf9f3fe04d7.js:14
    t.<computed> @ 3441.f43d0bf9f3fe04d7.js:53
    (anonymous) @ 3441.f43d0bf9f3fe04d7.js:53
    (anonymous) @ 3441.f43d0bf9f3fe04d7.js:53
    (anonymous) @ 3441.f43d0bf9f3fe04d7.js:14
    await in (anonymous) (async)
    o.emit @ 1128.2c21108c747a947a.js:6
    onMessageEvent @ 3441.f43d0bf9f3fe04d7.js:14
    await in onMessageEvent (async)
    onProviderPayload @ 3441.f43d0bf9f3fe04d7.js:14
    await in onProviderPayload (async)
    onPayloadHandler @ 3441.f43d0bf9f3fe04d7.js:14
    o.emit @ 1128.2c21108c747a947a.js:6
    onPayload @ 3441.f43d0bf9f3fe04d7.js:14
    (anonymous) @ 3441.f43d0bf9f3fe04d7.js:14
    o.emit @ 1128.2c21108c747a947a.js:6
    onPayload @ 3441.f43d0bf9f3fe04d7.js:14
    e.onmessage @ 3441.f43d0bf9f3fe04d7.js:14
    7023-0f706cc01d74f57c.js:1 {context: 'client'} Error: No matching key. history: 1717059665515776
       at rG.getRecord (3441.f43d0bf9f3fe04d7.js:14:85158)
       at rG.get (3441.f43d0bf9f3fe04d7.js:14:83786)
       at im.onRelayEventResponse (3441.f43d0bf9f3fe04d7.js:14:119380)
       at o.<anonymous> (3441.f43d0bf9f3fe04d7.js:14:137169)
  • This happens to me the first time I use the WC feature after opening the browser, with Firefox. I open Challenge 0 and connect (OK). Then try to fire a Mint tx, but it says "Cannot access account". If I disconnect and connect again, it works fine, but if I close Firefox, and connect again, it says "Cannot access account" again.
  • When I disconnect from the dapp, and connect again, i keep getting "Wrong network" message. It also happens if I connect to a different Challenge, for example:

    • Connect to Chal 0, disconnect.
    • Connect to Chal 5, get "Wrong network" message > Change network to Sepolia in dapp > Disconnect
    • Connect to Chal 0, get the "Wrong network" message again.
damianmarti commented 1 month ago

@Pabl0cks An update from the pending issues:

After last tests, I found these issues:

  • Now when I disconnect from burner, it doesn't propagate to the dapp. In the dapp I get this console error:
    Uncaught (in promise) SwitchChainError
      at tE.switchChain (6973-bbcb1d9123eac5c5.js:68:5251)
      at async tE.getProvider (6973-bbcb1d9123eac5c5.js:68:4002)
      at async Promise.all (/index 0)
      at async tE.getWalletClient (6973-bbcb1d9123eac5c5.js:68:4092)
      at async eo (6973-bbcb1d9123eac5c5.js:71:11396)
      at async n (6973-bbcb1d9123eac5c5.js:71:11744)Caused by: TypeError: Cannot set properties of undefined (setting 'defaultChain')
      at cp.onChainChanged (1482.d1dae5cb5008ff78.js:75:29307)
      at o.<anonymous> (1482.d1dae5cb5008ff78.js:75:28047)
      at o.emit (2421-73e9c077238b2845.js:1:87232)
      at u4.setDefaultChain (1482.d1dae5cb5008ff78.js:75:10482)
      at u4.handleSwitchChain (1482.d1dae5cb5008ff78.js:75:11732)
      at u4.request (1482.d1dae5cb5008ff78.js:75:10092)
      at cp.request (1482.d1dae5cb5008ff78.js:75:22536)
      at cx.request (1482.d1dae5cb5008ff78.js:75:31536)
      at tE.switchChain (6973-bbcb1d9123eac5c5.js:68:5062)
      at async tE.getProvider (6973-bbcb1d9123eac5c5.js:68:4002)

The disconnect issue is fixed now. I had to update walletconnect/web3wallet to 1.12.1 because I was receiving the session_proposal event twice. After updating it's working ok, but the web3wallet takes a couple of seconds to initialize (I don't know why, with the previous version it was a lot faster). I added an initialized flag to avoid trying to connect to a dapp before the web3wallet is initialized. I will try to figure out why the web3wallet takes a lot of time to initialize.

  • If you close the WC modal in the dapp (the one that lets you copy the code), it says "Connected" when you click "Connect Dapp" in the burner, but it doesn't really connect.

I'm not finding a way to fix this. The wallet receives the session_proposal like the WC modal in the dapp was open. Trying to find in the WC documentation a way to catch this issue...

In the dapp I get this console error:

  Error: Connection request reset. Please try again.
   at 3441.f43d0bf9f3fe04d7.js:40:33700
   at 5318.50d80505945cd5ea.js:1:10628
   at 5318.50d80505945cd5ea.js:1:3336
   window.console.error @ 7023-0f706cc01d74f57c.js:1
   7023-0f706cc01d74f57c.js:1 {time: 1717059677525, level: 50, context: 'core/pairing'}
   window.console.error @ 7023-0f706cc01d74f57c.js:1
   forwardToConsole @ 3441.f43d0bf9f3fe04d7.js:14
   appendToLogs @ 3441.f43d0bf9f3fe04d7.js:14
   write @ 3441.f43d0bf9f3fe04d7.js:14
   write @ 3441.f43d0bf9f3fe04d7.js:14
   t.<computed> @ 3441.f43d0bf9f3fe04d7.js:53
   (anonymous) @ 3441.f43d0bf9f3fe04d7.js:53
   (anonymous) @ 3441.f43d0bf9f3fe04d7.js:53
   (anonymous) @ 3441.f43d0bf9f3fe04d7.js:14
   await in (anonymous) (async)
   o.emit @ 1128.2c21108c747a947a.js:6
   onMessageEvent @ 3441.f43d0bf9f3fe04d7.js:14
   await in onMessageEvent (async)
   onProviderPayload @ 3441.f43d0bf9f3fe04d7.js:14
   await in onProviderPayload (async)
   onPayloadHandler @ 3441.f43d0bf9f3fe04d7.js:14
   o.emit @ 1128.2c21108c747a947a.js:6
   onPayload @ 3441.f43d0bf9f3fe04d7.js:14
   (anonymous) @ 3441.f43d0bf9f3fe04d7.js:14
   o.emit @ 1128.2c21108c747a947a.js:6
   onPayload @ 3441.f43d0bf9f3fe04d7.js:14
   e.onmessage @ 3441.f43d0bf9f3fe04d7.js:14
   7023-0f706cc01d74f57c.js:1 {context: 'client'} Error: No matching key. history: 1717059665515776
       at rG.getRecord (3441.f43d0bf9f3fe04d7.js:14:85158)
       at rG.get (3441.f43d0bf9f3fe04d7.js:14:83786)
       at im.onRelayEventResponse (3441.f43d0bf9f3fe04d7.js:14:119380)
       at o.<anonymous> (3441.f43d0bf9f3fe04d7.js:14:137169)
  • This happens to me the first time I use the WC feature after opening the browser, with Firefox. I open Challenge 0 and connect (OK). Then try to fire a Mint tx, but it says "Cannot access account". If I disconnect and connect again, it works fine, but if I close Firefox, and connect again, it says "Cannot access account" again.

I wasn't able to reproduce this bug. It happened to me some days ago, but now I'm not getting this error anymore. I will keep testing.

  • When I disconnect from the dapp, and connect again, i keep getting "Wrong network" message. It also happens if I connect to a different Challenge, for example:

    • Connect to Chal 0, disconnect.
    • Connect to Chal 5, get "Wrong network" message > Change network to Sepolia in dapp > Disconnect
    • Connect to Chal 0, get the "Wrong network" message again.

I'm not able to fix this bug yet. It's related to the setup of the chain in WC, but I couldn't find a way to avoid the dapp change the current network. If I only set up the current network in WC, it works ok, but it should be a way to avoid it leaving all the supported networks. Trying to find something in the documentation or Google...

Thanks!!

damianmarti commented 1 month ago

Ok, even it is still unstable when you start changing dapps and such, I think we can merge this and document all the pending TODOs and known issues, and keep iterating on them.

We can improve the signing modal and connected dapp drawer in the next PR also ๐Ÿ‘Œ

Thank you for all the hard testing!! Merged!

Pabl0cks commented 1 month ago

Thank you for all the hard testing!! Merged!

Thank you Damu!

I was talking with Carlos before, that it would be a good idea to hide the "Enter address or WC UID manually" button, until we polish WC feature a bit more.

damianmarti commented 1 month ago

Thank you for all the hard testing!! Merged!

Thank you Damu!

I was talking with Carlos before, that it would be a good idea to hide the "Enter address or WC UID manually" button, until we polish WC feature a bit more.

Yes, sure! https://github.com/BuidlGuidl/burnerwallet/pull/61

carletex commented 1 month ago

Great job! Thank you all!!

Yes, I think it was a good idea to add #61 so we can keep testing & iterating. And we can make it visible when everything is more polished