Skip to content

Commit

Permalink
fix multiple signatures bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Oct 10, 2023
1 parent 99c4ddf commit 532915c
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions tools/walletextension/api/staticOG/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ async function addNetworkToMetaMask(ethereum, userID) {

async function authenticateAccountWithObscuroGateway(ethereum, account, userID) {
const isAuthenticated = await accountIsAuthenticated(account, userID)

if (isAuthenticated) {
return "Account is already authenticated"
}
Expand Down Expand Up @@ -289,18 +288,6 @@ const initialize = async () => {
return displayOnlyJoin()
}

// if accounts change (user adds/removed connected accounts) we want to
window.ethereum.on('accountsChanged', async function (accounts) {
if (isValidUserIDFormat(await getUserID())) {
userID = await getUserID();
for (const account of accounts) {
await authenticateAccountWithObscuroGateway(ethereum, account, userID)
accountsTable.style.display = "block"
await populateAccountsTable(document, tableBody, userID)
}
}
});

// load the current version
await fetchAndDisplayVersion();

Expand Down Expand Up @@ -353,6 +340,18 @@ const initialize = async () => {
await populateAccountsTable(document, tableBody, userID)
}

// if accounts change we want to give user chance to add them to Obscuro
window.ethereum.on('accountsChanged', async function (accounts) {
if (isValidUserIDFormat(await getUserID())) {
userID = await getUserID();
for (const account of accounts) {
await authenticateAccountWithObscuroGateway(ethereum, account, userID)
accountsTable.style.display = "block"
await populateAccountsTable(document, tableBody, userID)
}
}
});

await displayConnectedAndJoinedSuccessfully()
}
})
Expand Down

0 comments on commit 532915c

Please sign in to comment.