diff --git a/package.json b/package.json index f19b55f7e50..f4d9bc484bc 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "pub": "node build/release.js" }, "dependencies": { - "@debank/common": "^0.3.34", + "@debank/common": "^0.3.35", "@debank/festats": "1.0.0", "@dnd-kit/core": "^5.0.1", "@dnd-kit/sortable": "^6.0.0", @@ -41,7 +41,7 @@ "@rabby-wallet/eth-walletconnect-keyring": "^1.7.21", "@rabby-wallet/eth-watch-keyring": "^1.0.0", "@rabby-wallet/gnosis-sdk": "^1.3.5", - "@rabby-wallet/page-provider": "^0.1.20", + "@rabby-wallet/page-provider": "^0.1.21", "@rabby-wallet/rabby-api": "^0.6.22", "@rabby-wallet/rabby-security-engine": "^1.1.16", "@rabby-wallet/rabby-swap": "^0.0.29", @@ -119,7 +119,7 @@ "uuid": "^9.0.0", "web3-eth-abi": "^1.7.0", "web3-utils": "^1.7.0", - "webextension-polyfill-ts": "^0.25.0" + "webextension-polyfill": "^0.10.0" }, "devDependencies": { "@sentry/webpack-plugin": "^1.18.9", @@ -135,6 +135,7 @@ "@types/react-router-dom": "^5.1.7", "@types/semver-compare": "^1.0.1", "@types/sinon": "^10.0.13", + "@types/webextension-polyfill": "^0.10.2", "@typescript-eslint/eslint-plugin": "^5.13.0", "@typescript-eslint/parser": "^4.22.1", "@welldone-software/why-did-you-render": "^6.2.1", diff --git a/src/background/index.ts b/src/background/index.ts index c8954149ffa..fcfb0b39163 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -1,7 +1,7 @@ import { groupBy } from 'lodash'; import 'reflect-metadata'; import * as Sentry from '@sentry/browser'; -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; import { ethErrors } from 'eth-rpc-errors'; import { WalletController } from 'background/controller/wallet'; import { Message } from '@/utils'; diff --git a/src/background/service/keyring/eth-bitbox02-keyring.ts b/src/background/service/keyring/eth-bitbox02-keyring.ts index bb495a8378f..df2ed344716 100644 --- a/src/background/service/keyring/eth-bitbox02-keyring.ts +++ b/src/background/service/keyring/eth-bitbox02-keyring.ts @@ -1,6 +1,6 @@ import 'regenerator-runtime/runtime'; import EventEmitter from 'events'; -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; import { BitBox02API, getDevicePath, constants } from 'bitbox02-api'; diff --git a/src/background/service/notification.ts b/src/background/service/notification.ts index 1460905f406..d93afadce8c 100644 --- a/src/background/service/notification.ts +++ b/src/background/service/notification.ts @@ -1,4 +1,4 @@ -import { Windows, browser } from 'webextension-polyfill-ts'; +import browser, { Windows } from 'webextension-polyfill'; import Events from 'events'; import { ethErrors } from 'eth-rpc-errors'; import { v4 as uuidv4 } from 'uuid'; diff --git a/src/background/service/preference.ts b/src/background/service/preference.ts index 801b94db766..469ce853d7b 100644 --- a/src/background/service/preference.ts +++ b/src/background/service/preference.ts @@ -9,7 +9,7 @@ import { } from './index'; import { TotalBalanceResponse, TokenItem } from './openapi'; import { HARDWARE_KEYRING_TYPES, EVENTS, CHAINS_ENUM, LANGS } from 'consts'; -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; import semver from 'semver-compare'; const version = process.env.release || '0'; diff --git a/src/background/webapi/notification.ts b/src/background/webapi/notification.ts index bccce9bd805..1d7e5ecea34 100644 --- a/src/background/webapi/notification.ts +++ b/src/background/webapi/notification.ts @@ -1,4 +1,4 @@ -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; import { createTab } from './tab'; browser.notifications.onClicked.addListener((url) => { @@ -17,7 +17,7 @@ const create = ( browser.notifications.create(url && `${url}_randomId_=${randomId}`, { type: 'basic', title, - iconUrl: browser.extension.getURL('./images/icon-64.png'), + iconUrl: browser.runtime.getURL('./images/icon-64.png'), message, priority, }); diff --git a/src/background/webapi/storage.ts b/src/background/webapi/storage.ts index 2d6284c3e17..7c3e02860d1 100644 --- a/src/background/webapi/storage.ts +++ b/src/background/webapi/storage.ts @@ -1,4 +1,4 @@ -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; let cacheMap; diff --git a/src/background/webapi/tab.ts b/src/background/webapi/tab.ts index b1d2a87b30b..7fc24597d85 100644 --- a/src/background/webapi/tab.ts +++ b/src/background/webapi/tab.ts @@ -1,4 +1,4 @@ -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; import { EventEmitter } from 'events'; const tabEvent = new EventEmitter(); diff --git a/src/background/webapi/window.ts b/src/background/webapi/window.ts index e2ea25bff8a..89542f65968 100644 --- a/src/background/webapi/window.ts +++ b/src/background/webapi/window.ts @@ -1,4 +1,4 @@ -import { browser, Windows } from 'webextension-polyfill-ts'; +import browser, { Windows } from 'webextension-polyfill'; import { EventEmitter } from 'events'; import { IS_WINDOWS } from 'consts'; diff --git a/src/content-script/index.ts b/src/content-script/index.ts index 9fa7187ee9e..6ef8159e257 100644 --- a/src/content-script/index.ts +++ b/src/content-script/index.ts @@ -1,6 +1,5 @@ import { Message } from '@/utils'; import { nanoid } from 'nanoid'; -import { browser } from 'webextension-polyfill-ts'; const channelName = nanoid(); diff --git a/src/ui/utils/webapi.ts b/src/ui/utils/webapi.ts index af6405a432d..94393bad4ff 100644 --- a/src/ui/utils/webapi.ts +++ b/src/ui/utils/webapi.ts @@ -1,4 +1,4 @@ -import { Tabs, browser, Windows } from 'webextension-polyfill-ts'; +import browser, { Tabs, Windows } from 'webextension-polyfill'; import { WalletController, WalletControllerType } from './index'; import { getOriginFromUrl } from '@/utils'; diff --git a/src/utils/index.ts b/src/utils/index.ts index 2670abe2db3..d3390c87d1e 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,6 +1,6 @@ import { CHAINS } from '@/constant'; import { keyBy } from 'lodash'; -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; import { ledgerUSBVendorId } from '@ledgerhq/devices'; import BroadcastChannelMessage from './message/broadcastChannelMessage'; diff --git a/src/utils/ledger.ts b/src/utils/ledger.ts index bae4eac452f..c74a63c73ee 100644 --- a/src/utils/ledger.ts +++ b/src/utils/ledger.ts @@ -1,7 +1,7 @@ import { ledgerUSBVendorId } from '@ledgerhq/devices'; import { useEffect, useState } from 'react'; import { hasConnectedLedgerDevice } from '@/utils'; -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; export enum LedgerHDPathType { LedgerLive = 'LedgerLive', diff --git a/src/utils/matomo-request.ts b/src/utils/matomo-request.ts index cb95849b16e..f443b6f54d2 100644 --- a/src/utils/matomo-request.ts +++ b/src/utils/matomo-request.ts @@ -1,5 +1,5 @@ import { customAlphabet, nanoid } from 'nanoid'; -import { browser } from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; const ANALYTICS_PATH = 'https://matomo.debank.com/matomo.php'; const genExtensionId = customAlphabet('1234567890abcdef', 16); diff --git a/src/utils/message/portMessage.ts b/src/utils/message/portMessage.ts index 2ea271107b0..77a0e651c43 100644 --- a/src/utils/message/portMessage.ts +++ b/src/utils/message/portMessage.ts @@ -1,4 +1,4 @@ -import { Runtime, browser } from 'webextension-polyfill-ts'; +import browser, { Runtime } from 'webextension-polyfill'; import Message from './index'; class PortMessage extends Message { port: Runtime.Port | null = null; diff --git a/yarn.lock b/yarn.lock index e6e11119181..109de6c3e08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1315,10 +1315,10 @@ resolved "https://registry.yarnpkg.com/@debank/common/-/common-0.3.0.tgz#9c67288816d62e3548e0c2193ec4cd73758f5b26" integrity sha512-PWdFuKuqDtGdYALFToDQQCyas3Tgz1tXXlir6UVTVHz2MPi4uK6ZK8UUNrWdU6lncHNvcRsNf3Xamk0Ga9jxeg== -"@debank/common@^0.3.34": - version "0.3.34" - resolved "https://registry.yarnpkg.com/@debank/common/-/common-0.3.34.tgz#6b00a636610f75ddd35f32f837237df3e92b49bc" - integrity sha512-TqLiO94ByQ/cnQRwQ/LALm6ENh2k0i/2hVv6Djfdrwo71AsEtrCqBUbf5I7bnQKqDE84++KivsA5EcVXFwFEug== +"@debank/common@^0.3.35": + version "0.3.35" + resolved "https://registry.yarnpkg.com/@debank/common/-/common-0.3.35.tgz#77de7394b127bee702b0f09c11c4890ac2a73471" + integrity sha512-TO7nxaTpsXAUJ1ozey9ic7lYN2yekL1CNBXX7oTSZRGTsUW++NbBQzdIyVNnfZTvI/nXoCljONI8bDTlGXyz9w== "@debank/festats@1.0.0": version "1.0.0" @@ -3525,10 +3525,10 @@ typescript "^4.5.0" web3-core "^1.6.0" -"@rabby-wallet/page-provider@^0.1.20": - version "0.1.20" - resolved "https://registry.yarnpkg.com/@rabby-wallet/page-provider/-/page-provider-0.1.20.tgz#6f2455273be15bf2f3c03b9cd9a947214f3d25ed" - integrity sha512-4j2eggrmXQ3OQ9/N36f2hI/qsQYM3UrUEKS5t0x/jRJuG2flj3x5OB8NBsJ/e5QSpDWhOJm0TXk+GCODVuZLQQ== +"@rabby-wallet/page-provider@^0.1.21": + version "0.1.21" + resolved "https://registry.yarnpkg.com/@rabby-wallet/page-provider/-/page-provider-0.1.21.tgz#e0fc081d4fa0b9c9d7f5de8f178733f63fc92703" + integrity sha512-enelvetTygLMW/FJtttFY31oR8/GUU0bQ+Q+51gZqEiNJFzJa5+mVi5hCExHc7urnLkDxK3sAC6TZcMdbctvsw== dependencies: "@ledgerhq/devices" "^6.27.1" "@types/chrome" "^0.0.186" @@ -3539,7 +3539,7 @@ events "^3.3.0" lodash "^4.17.21" sinon-chrome "^3.0.1" - webextension-polyfill-ts "^0.26.0" + webextension-polyfill "^0.10.0" "@rabby-wallet/rabby-api@^0.6.22": version "0.6.22" @@ -4702,6 +4702,11 @@ resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.80.tgz#bbf499be42b0e4ec1c417b89fde51e5afe062044" integrity sha512-HLbRwqCL5VVkmpAAzqRGXDkUO4teKhOOY2FJDHQl3k5OTuDTPzkI74AJSoGaS6oHOVVYhI/X5Ahw/ltC8KZQuw== +"@types/webextension-polyfill@^0.10.2": + version "0.10.2" + resolved "https://registry.yarnpkg.com/@types/webextension-polyfill/-/webextension-polyfill-0.10.2.tgz#14175d96d76339fce4d2b9b7837846148296cb5a" + integrity sha512-L+T72DVTi/1azY6gw7PRmL49kvobLKQQWfOmHDBRSCkAvaCV4wk222J3ZODYA9Gf/UqUvtItu8FPJgWX5ktO9g== + "@types/ws@^7.2.0": version "7.4.7" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.7.tgz#f7c390a36f7a0679aa69de2d501319f4f8d9b702" @@ -14871,29 +14876,10 @@ web3-utils@^1.6.0: randombytes "^2.1.0" utf8 "3.0.0" -webextension-polyfill-ts@^0.25.0: - version "0.25.0" - resolved "https://registry.yarnpkg.com/webextension-polyfill-ts/-/webextension-polyfill-ts-0.25.0.tgz#fff041626365dbd0e29c40b197e989a55ec221ca" - integrity sha512-ikQhwwHYkpBu00pFaUzIKY26I6L87DeRI+Q6jBT1daZUNuu8dSrg5U9l/ZbqdaQ1M/TTSPKeAa3kolP5liuedw== - dependencies: - webextension-polyfill "^0.7.0" - -webextension-polyfill-ts@^0.26.0: - version "0.26.0" - resolved "https://registry.yarnpkg.com/webextension-polyfill-ts/-/webextension-polyfill-ts-0.26.0.tgz#80b7063ddaf99abaa1ca73aad0cec09f306612d3" - integrity sha512-XEFL+aYVEsm/d4RajVwP75g56c/w2aSHnPwgtUv8/nCzbLNSzRQIix6aj1xqFkA5yr7OIDkk3OD/QTnPp8ThYA== - dependencies: - webextension-polyfill "^0.8.0" - -webextension-polyfill@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/webextension-polyfill/-/webextension-polyfill-0.7.0.tgz#0df1120ff0266056319ce1a622b09ad8d4a56505" - integrity sha512-su48BkMLxqzTTvPSE1eWxKToPS2Tv5DLGxKexLEVpwFd6Po6N8hhSLIvG6acPAg7qERoEaDL+Y5HQJeJeml5Aw== - -webextension-polyfill@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/webextension-polyfill/-/webextension-polyfill-0.8.0.tgz#f80e9f4b7f81820c420abd6ffbebfa838c60e041" - integrity sha512-a19+DzlT6Kp9/UI+mF9XQopeZ+n2ussjhxHJ4/pmIGge9ijCDz7Gn93mNnjpZAk95T4Tae8iHZ6sSf869txqiQ== +webextension-polyfill@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz#ccb28101c910ba8cf955f7e6a263e662d744dbb8" + integrity sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g== webidl-conversions@^3.0.0: version "3.0.1"