Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/snapshot-labs/lock
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Aug 1, 2024
2 parents f578200 + b5a3203 commit c371f9a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
14 changes: 13 additions & 1 deletion connectors/injected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@ export default class Connector extends LockConnector {
provider = window['ethereum'];
try {
await window['ethereum'].request({ method: 'eth_requestAccounts' })
} catch (e) {
} catch (e: any) {
console.error(e);
if (e.message = "Already processing eth_requestAccounts. Please wait.") {
try {
await provider.request({
method: "wallet_requestPermissions",
params: [{ eth_accounts: {} }],
});
} catch (e: any) {
console.error(e);
if (e.code === 4001 || -32002) return;
}
}

if (e.code === 4001) return;
}
} else if (window['web3']) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@snapshot-labs/lock",
"version": "0.2.3",
"version": "0.2.5",
"repository": "snapshot-labs/lock",
"license": "MIT",
"main": "dist/lock.cjs.js",
Expand Down
5 changes: 5 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export function getInjected() {
id: 'trustwallet',
icon: 'ipfs://QmQzchPwEa7UnRqSS7kSt4EJWMw5mcj9u3YtTp9uig9UT5'
};
if (web3.isMixin) injected = {
name: 'Mixin Messenger',
id: 'mixinmessenger',
icon: 'ipfs://QmT4ZcGMNoW34ZNgzjPJ6pqaoB5Fpk7z2d9yQqwGtCuEJC'
};
if (web3.isStatus) injected = {
name: 'Status',
id: 'status',
Expand Down

0 comments on commit c371f9a

Please sign in to comment.