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

Ziga/og fix frontend issues from workshop #1525

Merged
merged 10 commits into from
Sep 20, 2023

Conversation

zkokelj
Copy link
Contributor

@zkokelj zkokelj commented Sep 14, 2023

Why this change is needed

In this PR I fixed a few frontend bugs and added new features:

While doing this I fixed 2 bugs on OG backend:

  • use address 0x0...0 for getting UserID from getStorageAt (using anything that is not an address results in Metamask error)
  • allow Gateway to use defaultUser for the requests before / after joining (to avoid Metamask "infinite" loading while trying to get eth_blockNumber - especially problematic after revoking as we are calling it with userID which is not valid anymore, but is still in the rpcURL in Metamask)

What changes were made as part of this PR

Please provide a high level list of the changes made

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@zkokelj zkokelj marked this pull request as ready for review September 14, 2023 16:31
tools/walletextension/common/constants.go Outdated Show resolved Hide resolved
tools/walletextension/test/wallet_extension_test.go Outdated Show resolved Hide resolved
tools/walletextension/wallet_extension.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@otherview otherview left a comment

Choose a reason for hiding this comment

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

Minor bits.

One question, perhaps for a different PR. How does the connect to metamask process happen ? Typically there's a button for it right ?

tools/walletextension/api/staticOG/index.html Outdated Show resolved Hide resolved
tools/walletextension/api/staticOG/javascript.js Outdated Show resolved Hide resolved
tools/walletextension/api/staticOG/javascript.js Outdated Show resolved Hide resolved
tools/walletextension/api/staticOG/javascript.js Outdated Show resolved Hide resolved
@zkokelj
Copy link
Contributor Author

zkokelj commented Sep 20, 2023

Current version is not working in Google Chrome (changing getUserID to 0x0000000000000000000000000000000000000000 makes it work).

Even using ethers we get error:
image
which makes gateway useless

@otherview
Copy link
Contributor

Current version is not working in Google Chrome (changing getUserID to 0x0000000000000000000000000000000000000000 makes it work).

Even using ethers we get error: image which makes gateway useless

The issue is a bit hidden to be fair. It comes from infura / an rpc response, not from Metamask.
If Obscuroscan uses this method while Metamask is connected to Ethereum it gets the same response.

A try-catch seems to do the trick.

async function getUserID() {
    try {
        return await provider.send('eth_getStorageAt', ["getUserID", getRandomIntAsString(0, 1000), null])
    }catch (e) {
        console.log(e)
        return null;
    }
}

@zkokelj zkokelj merged commit 42669a4 into main Sep 20, 2023
@zkokelj zkokelj deleted the ziga/og_fix_frontend_issues_from_workshop branch September 20, 2023 12:40
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

Successfully merging this pull request may close these issues.

4 participants