diff --git a/build.crx b/build.crx
index 05e0256..47511b8 100644
Binary files a/build.crx and b/build.crx differ
diff --git a/landing/index.html b/landing/index.html
index 7d90e2c..015a051 100644
--- a/landing/index.html
+++ b/landing/index.html
@@ -61,7 +61,7 @@
get started
download
-
Cobweb is MIT-licensed and fully open source - the source is available on GitHub should you wish to build from source. The checksum of the current version is 29aec681ca1ed9d2da4f09bf558012dec69ef8f7bf81e1ccbcf8521602db7df2
.
+
Cobweb is MIT-licensed and fully open source - the source is available on GitHub should you wish to build from source. The checksum of the current version is e76cb27d110f9544d3345644827af159e2750ffaad9e0660d63a931c907a32ba
.
view source
diff --git a/src/pages/Background/index.ts b/src/pages/Background/index.ts
index f3b6806..f1fc5fc 100644
--- a/src/pages/Background/index.ts
+++ b/src/pages/Background/index.ts
@@ -2,7 +2,7 @@
// https://github.com/tsarpaul/citadelnfts-extension/blob/master/patch_metamask_provider.py
import createMetaMaskProvider from "metamask-extension-provider";
import { MetaMaskInpageProvider } from "@metamask/inpage-provider";
-import { BigNumber, ethers, constants, Signer } from "ethers";
+import { BigNumber, ethers } from "ethers";
import { Framework } from "@superfluid-finance/sdk-core";
import {
INFURA_PROJECT_ID,
@@ -62,16 +62,28 @@ metamaskProvider.on("disconnect", () => {
storage.local.set({ mmNotFound: true });
});
+metamaskProvider.on("connect", async () => {
+ try {
+ storage.local.set({
+ mmNotFound: (await mmProvider.listAccounts()).length === 0,
+ });
+ } catch {
+ storage.local.set({ mmNotFound: true });
+ }
+});
+
metamaskProvider.on("accountsChanged", (accounts) => {
- setNewAddress({
- address: (accounts as Array)[0],
- provider: mmProvider,
- });
+ if ((accounts as Array).length === 0) {
+ storage.local.set({ mmNotFound: true });
+ } else {
+ setNewAddress({
+ address: (accounts as Array)[0],
+ provider: mmProvider,
+ });
+ }
});
-export const mmProvider = new ethers.providers.Web3Provider(
- metamaskProvider as any
-);
+const mmProvider = new ethers.providers.Web3Provider(metamaskProvider as any);
storage.local.set({ toasts: [] });
@@ -82,6 +94,9 @@ if (!addressTry || addressTry === "NO_ADDRESS") {
storage.local.set({
address: metamaskProvider.selectedAddress ?? "NO_ADDRESS",
});
+ if (!metamaskProvider.selectedAddress) {
+ storage.local.set({ mmNotFound: true });
+ }
}
let infuraProvider: InfuraProvider | null = null;
@@ -378,5 +393,3 @@ chrome.alarms.onAlarm.addListener(async (alarm) => {
}
} catch {}
});
-
-chrome.runtime.onConnect.addListener(() => {});
diff --git a/src/pages/Background/lib/fetchAndUpdateBalance.ts b/src/pages/Background/lib/fetchAndUpdateBalance.ts
index 2f6d601..dae866d 100644
--- a/src/pages/Background/lib/fetchAndUpdateBalance.ts
+++ b/src/pages/Background/lib/fetchAndUpdateBalance.ts
@@ -1,7 +1,7 @@
import { storage } from "@extend-chrome/storage";
import { Web3Provider } from "@ethersproject/providers";
import { Framework, SuperToken } from "@superfluid-finance/sdk-core";
-import { BigNumber, constants, Signer, utils } from "ethers";
+import { BigNumber, constants, utils } from "ethers";
import errorToast, { toast } from "../../shared/toast";
import { DELETE_STREAM } from "../../shared/events";
import { Rate } from "../../shared/types";
diff --git a/src/pages/Popup/ListSettings.tsx b/src/pages/Popup/ListSettings.tsx
index 0428450..77d7167 100644
--- a/src/pages/Popup/ListSettings.tsx
+++ b/src/pages/Popup/ListSettings.tsx
@@ -1,4 +1,4 @@
-import React, { useEffect } from "react";
+import React from "react";
import { useChromeStorageLocal } from "use-chrome-storage";
import { useState } from "react";
import { PayRates, Rate, RateSettings, Stream } from "../shared/types";
@@ -9,8 +9,6 @@ import Setting from "./components/Setting";
import "bootstrap-icons/font/bootstrap-icons.css";
import { UPDATE_STREAM } from "../shared/events";
import CobwebPage from "./components/CobwebPage";
-// @ts-expect-error
-import bootstrap from "bootstrap/dist/js/bootstrap.bundle";
import { toast } from "../shared/toast";
import verifySignature from "../shared/verifySignature";
import ToastHandler from "./components/ToastHandler";
diff --git a/src/pages/Popup/Popup.tsx b/src/pages/Popup/Popup.tsx
index dbf84d7..de80ebe 100644
--- a/src/pages/Popup/Popup.tsx
+++ b/src/pages/Popup/Popup.tsx
@@ -1,4 +1,4 @@
-import { ethers, BigNumber, constants } from "ethers";
+import { ethers, BigNumber } from "ethers";
import React, { useEffect, useState } from "react";
import { Link, Navigate, useSearchParams } from "react-router-dom";
import {