-
Notifications
You must be signed in to change notification settings - Fork 38
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/gateway metamask connect button #1579
Conversation
return accounts.length > 0; | ||
|
||
} catch (error) { | ||
console.log("Unable to get accounts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this return false ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already returning false (after catch statement is executed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor thing, non-blocker lgtm 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would had some info to the user or console if the join fails - but not a blocker imo, lgtm
headers: jsonHeaders, | ||
}); | ||
if (!joinResp.ok) { | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should something be logged to the console and/or user here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added console log and message to user to try again later.
WalkthroughThe changes primarily focus on enhancing the interaction with the Obscuro network in the wallet extension. The modifications include the removal of certain UI elements, addition of new functions to handle network-related tasks, and updates to existing functions to improve their functionality and efficiency. The changes aim to streamline the user experience and ensure the extension works seamlessly with the Obscuro network. Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files ignored due to filter (2)
- tools/walletextension/api/staticOG/MetaMaskIcon.png
- tools/walletextension/api/staticOG/favicon-32x32.png
Files selected for processing (2)
- tools/walletextension/api/staticOG/index.html (1 hunks)
- tools/walletextension/api/staticOG/javascript.js (8 hunks)
Files skipped from review due to trivial changes (1)
- tools/walletextension/api/staticOG/index.html
Additional comments (Suppressed): 9
tools/walletextension/api/staticOG/javascript.js (9)
24-25: The
obscuroChainIDHex
is now a constant and no longer passed as a parameter to theaddNetworkToMetaMask
function. Ensure that this change does not affect other parts of the code that might be using theaddNetworkToMetaMask
function.56-64: The
getNetworkName
function is a new addition and it returns the network name based on thegatewayAddress
. This is a good practice as it makes the code more maintainable and easier to update in the future if more networks are added.67-78: The
addNetworkToMetaMask
function has been updated to use thegetNetworkName
function and theobscuroChainIDHex
constant. This is a good practice as it makes the code more maintainable and easier to update in the future if more networks are added.151-162: The
getUserID
function has been updated to check if the current chain is Obscuro before attempting to retrieve the user ID. This is a good practice as it prevents unnecessary requests from being made if the current chain is not Obscuro.164-167: The
connectAccount
function has been renamed toconnectAccounts
and no longer takes any parameters. Ensure that this change does not affect other parts of the code that might be using theconnectAccount
function.174-184: The
isMetamaskConnected
function is a new addition and it checks if any accounts are connected to MetaMask. This is a good practice as it allows the code to handle different scenarios based on whether or not MetaMask is connected.239-255: The
isObscuroChain
andswitchToObscuroNetwork
functions are new additions and they check if the current chain is Obscuro and switch to the Obscuro network if necessary. These are good practices as they allow the code to handle different scenarios based on the current chain.257-360: The
initialize
function has been significantly updated to handle different scenarios based on the current chain and user ID. This is a good practice as it makes the code more flexible and easier to maintain. However, ensure that these changes do not affect other parts of the code that might be using theinitialize
function.364-371: The
revokeUserIDButton
event listener has been updated to call thedisplayOnlyJoin
function if the user ID is successfully revoked. This is a good practice as it provides immediate feedback to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files selected for processing (1)
- tools/walletextension/api/staticOG/javascript.js (9 hunks)
Additional comments (Suppressed): 10
tools/walletextension/api/staticOG/javascript.js (10)
8-9: New constants
idAccountsTable
andidTableBody
are introduced. Ensure these IDs are correctly assigned in the HTML file.24-25: The
obscuroChainIDHex
constant is introduced. Ensure that theobscuroChainIDDecimal
variable is defined and correctly set before this line.57-66: The
getNetworkName
function is introduced. This function returns the network name based on thegatewayAddress
. Ensure that all possiblegatewayAddress
values are covered in the switch statement.85-96: The
addNetworkToMetaMask
function is modified. ThechainId
andchainName
are now set using the new constants and functions. Ensure that these changes do not affect the function's behavior.169-180: The
getUserID
function is modified. It now checks if the current chain is Obscuro before attempting to get the user ID. This is a good practice as it prevents unnecessary requests on non-Obscuro chains.182-185: The
connectAccount
function is renamed toconnectAccounts
. Ensure that all calls to this function throughout the codebase have been updated to match the new name.192-202: The
isMetamaskConnected
function is introduced. This function checks if MetaMask is connected by checking if there are any accounts. This is a good practice as it allows the application to handle scenarios where MetaMask is not connected.257-273: The
isObscuroChain
andswitchToObscuroNetwork
functions are introduced. These functions check if the current chain is Obscuro and switch to the Obscuro network, respectively. These are good practices as they allow the application to handle scenarios where the user is on a different chain.275-378: The
initialize
function is significantly modified. It now handles different scenarios based on the current chain and user ID. This is a good practice as it allows the application to adapt to different user states. However, this function has become quite complex. Consider breaking it down into smaller, more manageable functions.382-389: The
revokeUserIDButton
event listener is modified. It now calls thedisplayOnlyJoin
function if the user ID is successfully revoked. This is a good practice as it updates the UI to reflect the user's new state.
Why this change is needed
For the users to select which accounts they want to connect from metamask
What changes were made as part of this PR
PR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks