Skip to content

Commit

Permalink
v1.0.6-beta
Browse files Browse the repository at this point in the history
- Hotfix for error thrown when getting accounts from wallet
  • Loading branch information
iPaulPro committed Feb 23, 2023
1 parent a440224 commit f29f03f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"manifest_version": 3,
"name": "Focalize - Post on Lens Protocol",
"short_name": "Focalize",
"version": "1.0.5",
"version_name": "1.0.5-beta",
"version": "1.0.6",
"version_name": "1.0.6-beta",
"description": "Extension for Publishing on Lens Protocol",
"permissions": [
"activeTab",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "focalize",
"private": true,
"version": "1.0.5",
"version": "1.0.6",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
23 changes: 9 additions & 14 deletions src/lib/ethers-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,21 @@ const getProviderFromWeb3Modal = async (): Promise<Web3Provider> => {
};

export const getAccounts = async (): Promise<string[]> => {
if (!provider) throw ('Provider is null. You must call init() first');
return await provider.listAccounts();
if (!provider) throw ('Provider is null. You must call initEthers() first');
let accounts: string[];
try {
accounts = await provider.listAccounts();
} catch (e) {
accounts = await provider.send('eth_requestAccounts', []);
}
return accounts;
}

const getAccountsFromMetaMask = (): Promise<string[]> => new Promise(async (resolve, reject) => {
const inPageProvider = createExternalExtensionProvider();
inPageProvider.on('error', (error) => {
reject(error);
});

provider = new Web3Provider(inPageProvider, "any");
const accounts = await provider.send('eth_requestAccounts', []);
resolve(accounts);
});

export const initEthers = async(): Promise<any[]> => {
if (!provider) {
provider = await getProviderFromWeb3Modal();
}
return await provider.listAccounts();
return await getAccounts();
}

export const signTypedData = (
Expand Down

0 comments on commit f29f03f

Please sign in to comment.