@onekeyfe/inpage-providers-hub 2.1.17-alpha.0 → 2.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/connectButtonHack/consts.js +1 -1
- package/dist/cjs/connectButtonHack/hackConnectButton.js +13 -10
- package/dist/cjs/connectButtonHack/index.js +1 -2
- package/dist/cjs/connectButtonHack/sites/1inch.js +2 -2
- package/dist/cjs/connectButtonHack/sites/_template.js +2 -2
- package/dist/cjs/connectButtonHack/sites/walletconnect.js +6 -6
- package/dist/cjs/connectButtonHack/sites/zapper.js +1 -1
- package/dist/cjs/connectButtonHack/universal/config.js +13 -13
- package/dist/cjs/connectButtonHack/universal/findIconAndName.js +3 -4
- package/dist/cjs/connectButtonHack/universal/imgUtils.js +6 -7
- package/dist/cjs/connectButtonHack/universal/shadowRoot.js +1 -2
- package/dist/cjs/connectButtonHack/universal/textUtils.js +7 -8
- package/dist/cjs/connectButtonHack/universal/utils.js +8 -8
- package/dist/cjs/detectRiskWebsite/index.js +2 -3
- package/dist/cjs/injectWeb3Provider.js +13 -5
- package/dist/connectButtonHack/hackConnectButton.js +9 -5
- package/dist/connectButtonHack/sites/1inch.js +2 -2
- package/dist/connectButtonHack/sites/_template.js +2 -2
- package/dist/connectButtonHack/sites/walletconnect.js +6 -6
- package/dist/connectButtonHack/sites/zapper.js +1 -1
- package/dist/connectButtonHack/universal/config.js +13 -13
- package/dist/connectButtonHack/universal/utils.d.ts +1 -1
- package/dist/injectWeb3Provider.d.ts +2 -0
- package/dist/injectWeb3Provider.js +12 -3
- package/package.json +22 -22
|
@@ -15,7 +15,7 @@ var WALLET_NAMES;
|
|
|
15
15
|
WALLET_NAMES["polkadot"] = "polkadot";
|
|
16
16
|
WALLET_NAMES["suiwallet"] = "suiwallet";
|
|
17
17
|
WALLET_NAMES["tronlink"] = "tronlink";
|
|
18
|
-
})(WALLET_NAMES
|
|
18
|
+
})(WALLET_NAMES || (exports.WALLET_NAMES = WALLET_NAMES = {}));
|
|
19
19
|
exports.WALLET_CONNECT_INFO = {
|
|
20
20
|
onekey: {
|
|
21
21
|
text: 'OneKey',
|
|
@@ -9,7 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.detectQrcodeFromSvg = detectQrcodeFromSvg;
|
|
13
|
+
exports.createWalletConnectToButton = createWalletConnectToButton;
|
|
14
|
+
exports.createNewImageToContainer = createNewImageToContainer;
|
|
15
|
+
exports.hackConnectButton = hackConnectButton;
|
|
13
16
|
const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-core");
|
|
14
17
|
const lodash_1 = require("lodash");
|
|
15
18
|
const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
|
|
@@ -69,23 +72,23 @@ function getEnabledProviders({ providers, }) {
|
|
|
69
72
|
return checkIfInjectedProviderEnable({ providerName });
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
|
-
function detectQrcodeFromSvg(
|
|
73
|
-
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
function detectQrcodeFromSvg(_a) {
|
|
76
|
+
return __awaiter(this, arguments, void 0, function* ({ img, }) {
|
|
75
77
|
// https://unpkg.com/qr-scanner@1.4.1/qr-scanner.umd.min.js
|
|
78
|
+
var _b, _c;
|
|
76
79
|
// Firefox does not support drawing SVG images to canvas
|
|
77
80
|
// Unless the svg file has width/height attributes on the root <svg> element
|
|
78
81
|
try {
|
|
79
82
|
img.setAttribute('width', img.clientWidth.toString());
|
|
80
83
|
img.setAttribute('height', img.clientHeight.toString());
|
|
81
84
|
}
|
|
82
|
-
catch (
|
|
85
|
+
catch (_d) {
|
|
83
86
|
//pass
|
|
84
87
|
}
|
|
85
88
|
const serialized = new XMLSerializer().serializeToString(img);
|
|
86
89
|
const encodedData = window.btoa(serialized);
|
|
87
90
|
const base64 = `data:image/svg+xml;base64,${encodedData}`;
|
|
88
|
-
const res = (yield ((
|
|
91
|
+
const res = (yield ((_c = (_b = window.$onekey) === null || _b === void 0 ? void 0 : _b.$private) === null || _c === void 0 ? void 0 : _c.request({
|
|
89
92
|
method: 'wallet_scanQrcode',
|
|
90
93
|
params: [{ base64 }],
|
|
91
94
|
})));
|
|
@@ -119,9 +122,12 @@ function detectQrcodeFromSvg({ img, }) {
|
|
|
119
122
|
});
|
|
120
123
|
}
|
|
121
124
|
return '';
|
|
125
|
+
// const res = await fetch(base64);
|
|
126
|
+
// const blob = await res.blob();
|
|
127
|
+
// const result = await barcodeDetector.detect(blob);
|
|
128
|
+
// return result?.[0]?.rawValue;
|
|
122
129
|
});
|
|
123
130
|
}
|
|
124
|
-
exports.detectQrcodeFromSvg = detectQrcodeFromSvg;
|
|
125
131
|
let isAddedRotateAnimation = false;
|
|
126
132
|
function addRotateAnimationToCss() {
|
|
127
133
|
if (isAddedRotateAnimation) {
|
|
@@ -200,7 +206,6 @@ text-align: center;
|
|
|
200
206
|
container.append(btn);
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
|
-
exports.createWalletConnectToButton = createWalletConnectToButton;
|
|
204
209
|
function createNewImageToContainer({ container, icon, removeSvg = true, onCreated, width, height, }) {
|
|
205
210
|
if (removeSvg) {
|
|
206
211
|
const svg = container.querySelector('svg');
|
|
@@ -225,7 +230,6 @@ function createNewImageToContainer({ container, icon, removeSvg = true, onCreate
|
|
|
225
230
|
container.prepend(newImg);
|
|
226
231
|
}
|
|
227
232
|
}
|
|
228
|
-
exports.createNewImageToContainer = createNewImageToContainer;
|
|
229
233
|
function hackConnectButton({ urls, replaceMethod, providers, mutationObserverOptions = {
|
|
230
234
|
attributes: false,
|
|
231
235
|
characterData: false,
|
|
@@ -325,4 +329,3 @@ function hackConnectButton({ urls, replaceMethod, providers, mutationObserverOpt
|
|
|
325
329
|
}
|
|
326
330
|
}, 3000);
|
|
327
331
|
}
|
|
328
|
-
exports.hackConnectButton = hackConnectButton;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.hackAllConnectButtons =
|
|
6
|
+
exports.hackAllConnectButtons = hackAllConnectButtons;
|
|
7
7
|
// import walletconnect from './sites/walletconnect';
|
|
8
8
|
// ---------
|
|
9
9
|
const opensea_1 = __importDefault(require("./sites/opensea"));
|
|
@@ -90,4 +90,3 @@ function hackAllConnectButtons() {
|
|
|
90
90
|
(0, benqi_1.default)();
|
|
91
91
|
(0, index_1.default)();
|
|
92
92
|
}
|
|
93
|
-
exports.hackAllConnectButtons = hackAllConnectButtons;
|
|
@@ -25,12 +25,12 @@ exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
replaceFunc({
|
|
28
|
-
findName: 'Metamask',
|
|
28
|
+
findName: 'Metamask', // Metamask MetaMask
|
|
29
29
|
icon: consts_1.WALLET_CONNECT_INFO.metamask.icon,
|
|
30
30
|
text: consts_1.WALLET_CONNECT_INFO.metamask.text,
|
|
31
31
|
});
|
|
32
32
|
replaceFunc({
|
|
33
|
-
findName: 'WalletConnect',
|
|
33
|
+
findName: 'WalletConnect', // Metamask MetaMask
|
|
34
34
|
icon: consts_1.WALLET_CONNECT_INFO.walletconnect.icon,
|
|
35
35
|
text: consts_1.WALLET_CONNECT_INFO.walletconnect.text,
|
|
36
36
|
});
|
|
@@ -5,8 +5,8 @@ const hackConnectButton_1 = require("../hackConnectButton");
|
|
|
5
5
|
const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
|
|
6
6
|
const consts_1 = require("../consts");
|
|
7
7
|
exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
|
|
8
|
-
urls: ['stake.lido.fi'],
|
|
9
|
-
providers: [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum],
|
|
8
|
+
urls: ['stake.lido.fi'], // adapter to the site url, can have multiple urls.
|
|
9
|
+
providers: [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum], // provider class, example: IInjectedProviderNames.ethereum、IInjectedProviderNames.btc
|
|
10
10
|
replaceMethod(options) {
|
|
11
11
|
var _a;
|
|
12
12
|
const replaceFunc = ({ findName, icon, text, }) => {
|
|
@@ -36,8 +36,8 @@ exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
const { isExtension, isDesktop, isNative } = onekeyHub.$walletInfo.platformEnv;
|
|
39
|
-
const replaceFunc = (
|
|
40
|
-
var
|
|
39
|
+
const replaceFunc = (_a) => __awaiter(this, [_a], void 0, function* ({ findName, icon, text, }) {
|
|
40
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
41
41
|
const headerText = document.getElementById('walletconnect-qrcode-text');
|
|
42
42
|
if (!headerText) {
|
|
43
43
|
return;
|
|
@@ -47,7 +47,7 @@ exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
// **** android single connect button replacement
|
|
50
|
-
const isAndroidSingleConnectButton = (
|
|
50
|
+
const isAndroidSingleConnectButton = (_c = (_b = headerNextSibling === null || headerNextSibling === void 0 ? void 0 : headerNextSibling.classList) === null || _b === void 0 ? void 0 : _b.contains) === null || _c === void 0 ? void 0 : _c.call(_b, 'walletconnect-connect__buttons__wrapper__android');
|
|
51
51
|
if (isAndroidSingleConnectButton) {
|
|
52
52
|
const btn = headerNextSibling.querySelector('.walletconnect-connect__button');
|
|
53
53
|
if (!btn) {
|
|
@@ -65,8 +65,8 @@ exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
// **** deeplink buttons replacement
|
|
68
|
-
const isSearchInput = (
|
|
69
|
-
const isConnectButtonsContainer = (
|
|
68
|
+
const isSearchInput = (_e = (_d = headerNextSibling === null || headerNextSibling === void 0 ? void 0 : headerNextSibling.classList) === null || _d === void 0 ? void 0 : _d.contains) === null || _e === void 0 ? void 0 : _e.call(_d, 'walletconnect-search__input');
|
|
69
|
+
const isConnectButtonsContainer = (_g = (_f = headerNextSibling === null || headerNextSibling === void 0 ? void 0 : headerNextSibling.classList) === null || _f === void 0 ? void 0 : _f.contains) === null || _g === void 0 ? void 0 : _g.call(_f, 'walletconnect-connect__buttons__wrapper__wrap');
|
|
70
70
|
if (isSearchInput || isConnectButtonsContainer) {
|
|
71
71
|
const shouldHideOtherWallets = isDesktop || isNative;
|
|
72
72
|
const inputEle = isSearchInput ? headerNextSibling : undefined;
|
|
@@ -142,7 +142,7 @@ exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
|
|
|
142
142
|
// remove input and footer pagination
|
|
143
143
|
if (shouldHideOtherWallets) {
|
|
144
144
|
inputEle === null || inputEle === void 0 ? void 0 : inputEle.remove();
|
|
145
|
-
const footerContainer = (
|
|
145
|
+
const footerContainer = (_h = iconsContainer === null || iconsContainer === void 0 ? void 0 : iconsContainer.parentNode) === null || _h === void 0 ? void 0 : _h.querySelector('.walletconnect-modal__footer');
|
|
146
146
|
footerContainer === null || footerContainer === void 0 ? void 0 : footerContainer.remove();
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -7,7 +7,7 @@ exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
|
|
|
7
7
|
urls: ['zapper.xyz', 'zapper.fi', 'www.zapper.xyz'],
|
|
8
8
|
providers: [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum],
|
|
9
9
|
mutationObserverOptions: {
|
|
10
|
-
attributes: true,
|
|
10
|
+
attributes: true, // shadowRoot changed watch required
|
|
11
11
|
characterData: false,
|
|
12
12
|
childList: true,
|
|
13
13
|
subtree: true,
|
|
@@ -931,7 +931,7 @@ exports.sitesConfig = [
|
|
|
931
931
|
},
|
|
932
932
|
},
|
|
933
933
|
{
|
|
934
|
-
urls: ['exchange.idex.io'],
|
|
934
|
+
urls: ['exchange.idex.io'], //not existed?
|
|
935
935
|
testPath: {
|
|
936
936
|
desktop: [':text("Get Started")', ':text("Connect Wallet")'],
|
|
937
937
|
mobile: [':text("Get Started")', ':text("Connect")'],
|
|
@@ -1137,7 +1137,7 @@ exports.sitesConfig = [
|
|
|
1137
1137
|
},
|
|
1138
1138
|
{
|
|
1139
1139
|
urls: ['www.convexfinance.com'],
|
|
1140
|
-
skip: true,
|
|
1140
|
+
skip: true, //no icon
|
|
1141
1141
|
walletsForProvider: {
|
|
1142
1142
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1143
1143
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { update({ updatedName, name }) {
|
|
@@ -1194,7 +1194,7 @@ exports.sitesConfig = [
|
|
|
1194
1194
|
},
|
|
1195
1195
|
{
|
|
1196
1196
|
urls: ['task.bsquared.network'],
|
|
1197
|
-
skip: { mobile: true },
|
|
1197
|
+
skip: { mobile: true }, //warn:mobile is not supported by the site
|
|
1198
1198
|
walletsForProvider: {
|
|
1199
1199
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1200
1200
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('.ReactModal__Content', 'Please Connect A Wallet') }),
|
|
@@ -1308,7 +1308,7 @@ exports.sitesConfig = [
|
|
|
1308
1308
|
desktop: [':text("Connect Wallet")'],
|
|
1309
1309
|
mobile: ['header.flex > button>svg', ':text("Connect Wallet")'],
|
|
1310
1310
|
},
|
|
1311
|
-
skip: true,
|
|
1311
|
+
skip: true, //temp skip
|
|
1312
1312
|
walletsForProvider: {
|
|
1313
1313
|
[cross_inpage_provider_types_1.IInjectedProviderNames.cardano]: [
|
|
1314
1314
|
Object.assign(Object.assign({}, exports.basicWalletInfo['nami']), { findIconAndName({ name }) {
|
|
@@ -1595,7 +1595,7 @@ exports.sitesConfig = [
|
|
|
1595
1595
|
},
|
|
1596
1596
|
{
|
|
1597
1597
|
urls: ['app.milkyway.zone'],
|
|
1598
|
-
skip: { mobile: true },
|
|
1598
|
+
skip: { mobile: true }, //WARN: mobile is not supported by the site
|
|
1599
1599
|
walletsForProvider: {
|
|
1600
1600
|
[cross_inpage_provider_types_1.IInjectedProviderNames.cosmos]: [
|
|
1601
1601
|
Object.assign(Object.assign({}, exports.basicWalletInfo['keplr']), { name: /^(Keplr|Keplr Mobile)$/i, container: 'div[aria-label="wallet list"][role="list"]' }),
|
|
@@ -1681,7 +1681,7 @@ exports.sitesConfig = [
|
|
|
1681
1681
|
],
|
|
1682
1682
|
desktop: ['.proceed-cta-checkbox input', 'button:text("Proceed")', ':text("Connect Wallet")'],
|
|
1683
1683
|
},
|
|
1684
|
-
skip: { mobile: true },
|
|
1684
|
+
skip: { mobile: true }, //input click not work
|
|
1685
1685
|
constraintMap: { icon: [imgUtils_1.isWalletIconLessEqualThan], text: [] },
|
|
1686
1686
|
walletsForProvider: {
|
|
1687
1687
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
@@ -1694,7 +1694,7 @@ exports.sitesConfig = [
|
|
|
1694
1694
|
},
|
|
1695
1695
|
{
|
|
1696
1696
|
urls: ['app.mai.finance'],
|
|
1697
|
-
skip: { mobile: true },
|
|
1697
|
+
skip: { mobile: true }, //it seems mobile is not supported
|
|
1698
1698
|
walletsForProvider: {
|
|
1699
1699
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1700
1700
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'button#connect-METAMASK' }),
|
|
@@ -1898,7 +1898,7 @@ exports.sitesConfig = [
|
|
|
1898
1898
|
},
|
|
1899
1899
|
{
|
|
1900
1900
|
urls: ['v2.sturdy.finance'],
|
|
1901
|
-
skip: { mobile: true },
|
|
1901
|
+
skip: { mobile: true }, //there is no entry for connect wallet
|
|
1902
1902
|
walletsForProvider: {
|
|
1903
1903
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1904
1904
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Connect a wallet') }),
|
|
@@ -2023,7 +2023,7 @@ exports.sitesConfig = [
|
|
|
2023
2023
|
},
|
|
2024
2024
|
{
|
|
2025
2025
|
urls: ['stake.anvm.io'],
|
|
2026
|
-
skip: { mobile: true },
|
|
2026
|
+
skip: { mobile: true }, //unistat is offline
|
|
2027
2027
|
testPath: {
|
|
2028
2028
|
desktop: [':text("Connect Wallet")', ':nth-match(button.rounded-full:text("Connect"),2)'],
|
|
2029
2029
|
'mobile': [
|
|
@@ -2061,14 +2061,14 @@ exports.sitesConfig = [
|
|
|
2061
2061
|
},
|
|
2062
2062
|
{
|
|
2063
2063
|
urls: ['app.gyro.finance'],
|
|
2064
|
-
skip: { mobile: true },
|
|
2064
|
+
skip: { mobile: true }, //not supported by mobile
|
|
2065
2065
|
walletsForProvider: {
|
|
2066
2066
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [metamaskForRainbowKit, walletConnectForRainbowKit],
|
|
2067
2067
|
},
|
|
2068
2068
|
},
|
|
2069
2069
|
{
|
|
2070
2070
|
urls: ['app.reflexer.finance'],
|
|
2071
|
-
skip: { mobile: true },
|
|
2071
|
+
skip: { mobile: true }, //no item in wallet list
|
|
2072
2072
|
constraintMap: { icon: [imgUtils_1.isWalletIconLessEqualThan], text: [] },
|
|
2073
2073
|
walletsForProvider: {
|
|
2074
2074
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
@@ -2410,7 +2410,7 @@ exports.sitesConfig = [
|
|
|
2410
2410
|
},
|
|
2411
2411
|
{
|
|
2412
2412
|
urls: ['app.pstake.finance'],
|
|
2413
|
-
skip: true,
|
|
2413
|
+
skip: true, //too slow
|
|
2414
2414
|
testUrls: ['app.pstake.finance/cosmos'],
|
|
2415
2415
|
walletsForProvider: {
|
|
2416
2416
|
[cross_inpage_provider_types_1.IInjectedProviderNames.cosmos]: [
|
|
@@ -2422,7 +2422,7 @@ exports.sitesConfig = [
|
|
|
2422
2422
|
},
|
|
2423
2423
|
{
|
|
2424
2424
|
urls: ['solo.top'],
|
|
2425
|
-
skip: { mobile: true },
|
|
2425
|
+
skip: { mobile: true }, //no metamask on mobile
|
|
2426
2426
|
constraintMap: { icon: [imgUtils_1.isWalletIconLessEqualThan], text: [] },
|
|
2427
2427
|
walletsForProvider: {
|
|
2428
2428
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.findIconAndNameByName = findIconAndNameByName;
|
|
4
|
+
exports.findIconAndNameByIcon = findIconAndNameByIcon;
|
|
5
|
+
exports.findTextByImg = findTextByImg;
|
|
4
6
|
const consts_1 = require("./consts");
|
|
5
7
|
const imgUtils_1 = require("./imgUtils");
|
|
6
8
|
const textUtils_1 = require("./textUtils");
|
|
@@ -52,7 +54,6 @@ function findIconAndNameByName(containerElement, walletName, icon = 'auto-search
|
|
|
52
54
|
// make sure the icon and text are both existed
|
|
53
55
|
return { iconNode, textNode };
|
|
54
56
|
}
|
|
55
|
-
exports.findIconAndNameByName = findIconAndNameByName;
|
|
56
57
|
function findIconAndNameByIcon(iconSelector, textSelector, name, container = document, constraints = { text: [], icon: [] }, searchLevel = consts_1.MAX_SEARCH_LEVELS_By_IMG) {
|
|
57
58
|
const iconElements = typeof iconSelector === 'string'
|
|
58
59
|
? container.querySelectorAll(iconSelector)
|
|
@@ -90,7 +91,6 @@ function findIconAndNameByIcon(iconSelector, textSelector, name, container = doc
|
|
|
90
91
|
textNode,
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
|
-
exports.findIconAndNameByIcon = findIconAndNameByIcon;
|
|
94
94
|
function findTextByImg(img, walletName, containerLimit, constraints, maxLevel = consts_1.MAX_SEARCH_LEVELS_By_IMG) {
|
|
95
95
|
let text = null;
|
|
96
96
|
let parent = img;
|
|
@@ -105,4 +105,3 @@ function findTextByImg(img, walletName, containerLimit, constraints, maxLevel =
|
|
|
105
105
|
utils_1.universalLog.warn('can not find the text node by img ', level);
|
|
106
106
|
return null;
|
|
107
107
|
}
|
|
108
|
-
exports.findTextByImg = findTextByImg;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.replaceIcon = replaceIcon;
|
|
4
|
+
exports.createImageEle = createImageEle;
|
|
5
|
+
exports.findIconNodesByParent = findIconNodesByParent;
|
|
6
|
+
exports.findWalletIconByParent = findWalletIconByParent;
|
|
7
|
+
exports.isWalletIconSizeMatch = isWalletIconSizeMatch;
|
|
8
|
+
exports.isWalletIconLessEqualThan = isWalletIconLessEqualThan;
|
|
4
9
|
const consts_1 = require("./consts");
|
|
5
10
|
const utils_1 = require("./utils");
|
|
6
11
|
/**
|
|
@@ -25,7 +30,6 @@ function replaceIcon(originalNode, newIconSrc) {
|
|
|
25
30
|
return imgNode;
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
|
-
exports.replaceIcon = replaceIcon;
|
|
29
33
|
function createImageEle(src) {
|
|
30
34
|
const img = new Image();
|
|
31
35
|
img.src = src;
|
|
@@ -33,7 +37,6 @@ function createImageEle(src) {
|
|
|
33
37
|
img.style.maxHeight = '100%';
|
|
34
38
|
return img;
|
|
35
39
|
}
|
|
36
|
-
exports.createImageEle = createImageEle;
|
|
37
40
|
function findIconNodesByParent(parent) {
|
|
38
41
|
const walker = document.createTreeWalker(parent, NodeFilter.SHOW_ELEMENT, {
|
|
39
42
|
acceptNode(node) {
|
|
@@ -49,7 +52,6 @@ function findIconNodesByParent(parent) {
|
|
|
49
52
|
}
|
|
50
53
|
return matchingNodes;
|
|
51
54
|
}
|
|
52
|
-
exports.findIconNodesByParent = findIconNodesByParent;
|
|
53
55
|
/**
|
|
54
56
|
* @description:
|
|
55
57
|
* make sure that there is only one icon node match walletIcon to ignore hidden icon and other icon
|
|
@@ -70,7 +72,6 @@ function findWalletIconByParent(parent, constraints) {
|
|
|
70
72
|
}
|
|
71
73
|
return icon;
|
|
72
74
|
}
|
|
73
|
-
exports.findWalletIconByParent = findWalletIconByParent;
|
|
74
75
|
//NOTE: use function isWalletIconLessEqualThan with lazy loading image
|
|
75
76
|
function isWalletIconSizeMatch(walletIcon, min = consts_1.ICON_MIN_SIZE, max = consts_1.ICON_MAX_SIZE) {
|
|
76
77
|
const { width, height } = walletIcon.getBoundingClientRect();
|
|
@@ -78,8 +79,6 @@ function isWalletIconSizeMatch(walletIcon, min = consts_1.ICON_MIN_SIZE, max = c
|
|
|
78
79
|
!isMatch && utils_1.universalLog.log('wallet icon size doesnot match: ', width, height);
|
|
79
80
|
return isMatch;
|
|
80
81
|
}
|
|
81
|
-
exports.isWalletIconSizeMatch = isWalletIconSizeMatch;
|
|
82
82
|
function isWalletIconLessEqualThan(walletIcon) {
|
|
83
83
|
return isWalletIconSizeMatch(walletIcon, 0, consts_1.ICON_MAX_SIZE);
|
|
84
84
|
}
|
|
85
|
-
exports.isWalletIconLessEqualThan = isWalletIconLessEqualThan;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findIconAndNameInShadowRoot =
|
|
3
|
+
exports.findIconAndNameInShadowRoot = findIconAndNameInShadowRoot;
|
|
4
4
|
const findIconAndName_1 = require("./findIconAndName");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
const imgUtils_1 = require("./imgUtils");
|
|
@@ -26,4 +26,3 @@ function findIconAndNameInShadowRoot(hostSelector, containerSelector, walletName
|
|
|
26
26
|
}
|
|
27
27
|
return (0, findIconAndName_1.findIconAndNameByName)(containerElements[0], walletName, 'auto-search-icon', constraints);
|
|
28
28
|
}
|
|
29
|
-
exports.findIconAndNameInShadowRoot = findIconAndNameInShadowRoot;
|
|
@@ -3,7 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.makeTextEllipse = makeTextEllipse;
|
|
7
|
+
exports.makeTextWrap = makeTextWrap;
|
|
8
|
+
exports.makeTextWordBreak = makeTextWordBreak;
|
|
9
|
+
exports.makeTextAlignLeft = makeTextAlignLeft;
|
|
10
|
+
exports.makeTextAlignCenter = makeTextAlignCenter;
|
|
11
|
+
exports.replaceText = replaceText;
|
|
12
|
+
exports.findWalletTextByParent = findWalletTextByParent;
|
|
7
13
|
const utilsDomNodes_1 = __importDefault(require("../utils/utilsDomNodes"));
|
|
8
14
|
const utils_1 = require("./utils");
|
|
9
15
|
function makeTextEllipse(textNode, option = {}) {
|
|
@@ -12,29 +18,23 @@ function makeTextEllipse(textNode, option = {}) {
|
|
|
12
18
|
textNode.style.textOverflow = 'ellipsis';
|
|
13
19
|
Object.assign(textNode.style, option);
|
|
14
20
|
}
|
|
15
|
-
exports.makeTextEllipse = makeTextEllipse;
|
|
16
21
|
function makeTextWrap(textNode) {
|
|
17
22
|
textNode.style.whiteSpace = 'normal';
|
|
18
23
|
}
|
|
19
|
-
exports.makeTextWrap = makeTextWrap;
|
|
20
24
|
function makeTextWordBreak(textNode) {
|
|
21
25
|
textNode.style.wordBreak = 'break-word';
|
|
22
26
|
}
|
|
23
|
-
exports.makeTextWordBreak = makeTextWordBreak;
|
|
24
27
|
function makeTextAlignLeft(textNode) {
|
|
25
28
|
textNode.style.textAlign = 'left';
|
|
26
29
|
}
|
|
27
|
-
exports.makeTextAlignLeft = makeTextAlignLeft;
|
|
28
30
|
function makeTextAlignCenter(textNode) {
|
|
29
31
|
textNode.style.textAlign = 'center';
|
|
30
32
|
}
|
|
31
|
-
exports.makeTextAlignCenter = makeTextAlignCenter;
|
|
32
33
|
function replaceText(textNode, newText) {
|
|
33
34
|
const newTextNode = document.createTextNode(newText);
|
|
34
35
|
textNode.replaceWith(newTextNode);
|
|
35
36
|
return newTextNode;
|
|
36
37
|
}
|
|
37
|
-
exports.replaceText = replaceText;
|
|
38
38
|
/**
|
|
39
39
|
* @description:
|
|
40
40
|
* make sure there is only one text node match walletName to ignore hidden text and other text
|
|
@@ -60,4 +60,3 @@ function findWalletTextByParent(container, walletName, constraints) {
|
|
|
60
60
|
}
|
|
61
61
|
return textNodes[0];
|
|
62
62
|
}
|
|
63
|
-
exports.findWalletTextByParent = findWalletTextByParent;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getConnectWalletModalByTitle = exports.getWalletListByBtn = exports.universalLog = void 0;
|
|
4
|
+
exports.isClickable = isClickable;
|
|
5
|
+
exports.isInExternalLink = isInExternalLink;
|
|
6
|
+
exports.isVisible = isVisible;
|
|
7
|
+
exports.createWalletId = createWalletId;
|
|
8
|
+
exports.arrayify = arrayify;
|
|
9
|
+
exports.getCommonParentElement = getCommonParentElement;
|
|
10
|
+
exports.getMaxWithOfText = getMaxWithOfText;
|
|
4
11
|
const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-core");
|
|
5
12
|
exports.universalLog = new cross_inpage_provider_core_1.Logger('universal');
|
|
6
13
|
//TODO:how to detect cursor status when hover
|
|
7
14
|
function isClickable(ele) {
|
|
8
15
|
return ele && window.getComputedStyle(ele).cursor === 'pointer';
|
|
9
16
|
}
|
|
10
|
-
exports.isClickable = isClickable;
|
|
11
17
|
const getWalletListByBtn = (anyButtonSelector) => {
|
|
12
18
|
const ele = document.querySelector(anyButtonSelector);
|
|
13
19
|
if (!ele || !ele.parentElement) {
|
|
@@ -50,12 +56,10 @@ function isInExternalLink(element, container) {
|
|
|
50
56
|
}
|
|
51
57
|
return false;
|
|
52
58
|
}
|
|
53
|
-
exports.isInExternalLink = isInExternalLink;
|
|
54
59
|
function isVisible(ele) {
|
|
55
60
|
const style = window.getComputedStyle(ele);
|
|
56
61
|
return style.visibility !== 'hidden' && style.display !== 'none';
|
|
57
62
|
}
|
|
58
|
-
exports.isVisible = isVisible;
|
|
59
63
|
function createWalletId(provider, updatedName) {
|
|
60
64
|
const walletId = `${provider}-${updatedName.replace(/[\s&.]/g, '').toLowerCase()}`.replace(/onekey/i, 'onekey-');
|
|
61
65
|
const walletIdSelector = `[data-wallet-id="${walletId}"]`;
|
|
@@ -70,11 +74,9 @@ function createWalletId(provider, updatedName) {
|
|
|
70
74
|
},
|
|
71
75
|
};
|
|
72
76
|
}
|
|
73
|
-
exports.createWalletId = createWalletId;
|
|
74
77
|
function arrayify(ele) {
|
|
75
78
|
return Array.isArray(ele) ? ele : [ele];
|
|
76
79
|
}
|
|
77
|
-
exports.arrayify = arrayify;
|
|
78
80
|
function getCommonParentElement(ele1, ele2) {
|
|
79
81
|
let parent = ele1;
|
|
80
82
|
while (parent) {
|
|
@@ -85,7 +87,6 @@ function getCommonParentElement(ele1, ele2) {
|
|
|
85
87
|
}
|
|
86
88
|
return null;
|
|
87
89
|
}
|
|
88
|
-
exports.getCommonParentElement = getCommonParentElement;
|
|
89
90
|
function getMaxWithOfText(textNode, icon, gap = '8px') {
|
|
90
91
|
const commonParent = getCommonParentElement(textNode.parentElement, icon);
|
|
91
92
|
if (!commonParent) {
|
|
@@ -100,4 +101,3 @@ function getMaxWithOfText(textNode, icon, gap = '8px') {
|
|
|
100
101
|
iconWidth,
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
|
-
exports.getMaxWithOfText = getMaxWithOfText;
|
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.detectWebsiteRiskLevel = detectWebsiteRiskLevel;
|
|
13
|
+
exports.listenPageFocus = listenPageFocus;
|
|
13
14
|
const style_1 = require("./style");
|
|
14
15
|
var EHostSecurityLevel;
|
|
15
16
|
(function (EHostSecurityLevel) {
|
|
@@ -137,7 +138,6 @@ function detectWebsiteRiskLevel() {
|
|
|
137
138
|
}
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
|
-
exports.detectWebsiteRiskLevel = detectWebsiteRiskLevel;
|
|
141
141
|
function listenPageFocus() {
|
|
142
142
|
// Notify the frontend of the last focused URL when the function is called
|
|
143
143
|
const notifyToBackground = () => {
|
|
@@ -164,4 +164,3 @@ function listenPageFocus() {
|
|
|
164
164
|
}
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
exports.listenPageFocus = listenPageFocus;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.injectWeb3Provider =
|
|
3
|
+
exports.injectWeb3Provider = injectWeb3Provider;
|
|
4
4
|
const onekey_eth_provider_1 = require("@onekeyfe/onekey-eth-provider");
|
|
5
5
|
const onekey_private_provider_1 = require("@onekeyfe/onekey-private-provider");
|
|
6
6
|
const onekey_solana_provider_1 = require("@onekeyfe/onekey-solana-provider");
|
|
@@ -10,11 +10,11 @@ const onekey_conflux_provider_1 = require("@onekeyfe/onekey-conflux-provider");
|
|
|
10
10
|
const onekey_alph_provider_1 = require("@onekeyfe/onekey-alph-provider");
|
|
11
11
|
const onekey_tron_provider_1 = require("@onekeyfe/onekey-tron-provider");
|
|
12
12
|
const onekey_cardano_provider_1 = require("@onekeyfe/onekey-cardano-provider");
|
|
13
|
-
// import { ProviderPrivateExternalAccount } from '@onekeyfe/onekey-private-external-account-provider';
|
|
14
13
|
const onekey_cosmos_provider_1 = require("@onekeyfe/onekey-cosmos-provider");
|
|
15
14
|
const onekey_polkadot_provider_1 = require("@onekeyfe/onekey-polkadot-provider");
|
|
16
15
|
const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-core");
|
|
17
16
|
const onekey_sui_provider_1 = require("@onekeyfe/onekey-sui-provider");
|
|
17
|
+
const onekey_bfc_provider_1 = require("@onekeyfe/onekey-bfc-provider");
|
|
18
18
|
const onekey_webln_provider_1 = require("@onekeyfe/onekey-webln-provider");
|
|
19
19
|
const onekey_scdo_provider_1 = require("@onekeyfe/onekey-scdo-provider");
|
|
20
20
|
const onekey_ton_provider_1 = require("@onekeyfe/onekey-ton-provider");
|
|
@@ -54,6 +54,9 @@ function injectWeb3Provider() {
|
|
|
54
54
|
const sui = new onekey_sui_provider_1.ProviderSui({
|
|
55
55
|
bridge,
|
|
56
56
|
});
|
|
57
|
+
const bfc = new onekey_bfc_provider_1.ProviderBfc({
|
|
58
|
+
bridge,
|
|
59
|
+
});
|
|
57
60
|
const cardano = new onekey_cardano_provider_1.ProviderCardano({
|
|
58
61
|
bridge,
|
|
59
62
|
});
|
|
@@ -79,15 +82,14 @@ function injectWeb3Provider() {
|
|
|
79
82
|
const btcWallet = new onekey_btc_provider_1.ProviderBtcWallet({ bridge });
|
|
80
83
|
const algorand = new onekey_algo_provider_1.ProviderAlgo({ bridge });
|
|
81
84
|
const scdo = new onekey_scdo_provider_1.ProviderScdo({ bridge });
|
|
82
|
-
// const $privateExternalAccount = new ProviderPrivateExternalAccount({ bridge });
|
|
83
85
|
// providerHub
|
|
84
86
|
const $onekey = Object.assign(Object.assign({}, window.$onekey), { jsBridge: bridge, $private,
|
|
85
|
-
// $privateExternalAccount,
|
|
86
87
|
ethereum,
|
|
87
88
|
solana,
|
|
88
89
|
// starcoin,
|
|
89
90
|
aptos: martian, conflux,
|
|
90
91
|
tron, sollet: null, sui,
|
|
92
|
+
bfc,
|
|
91
93
|
tonconnect,
|
|
92
94
|
cardano,
|
|
93
95
|
alephium,
|
|
@@ -134,6 +136,7 @@ function injectWeb3Provider() {
|
|
|
134
136
|
(0, onekey_alph_provider_1.registerAlephiumProvider)(alephium);
|
|
135
137
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('tronLink', tron);
|
|
136
138
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('suiWallet', sui);
|
|
139
|
+
(0, cross_inpage_provider_core_1.defineWindowProperty)('bfcWallet', bfc);
|
|
137
140
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('onekeyTonWallet', {
|
|
138
141
|
tonconnect,
|
|
139
142
|
});
|
|
@@ -187,6 +190,12 @@ function injectWeb3Provider() {
|
|
|
187
190
|
logo: consts_1.WALLET_CONNECT_INFO.onekey.icon,
|
|
188
191
|
});
|
|
189
192
|
}
|
|
193
|
+
// BFC Standard Wallet
|
|
194
|
+
if ((0, cross_inpage_provider_core_1.checkWalletSwitchEnable)()) {
|
|
195
|
+
(0, onekey_bfc_provider_1.registerBfcWallet)(bfc, {
|
|
196
|
+
logo: consts_1.WALLET_CONNECT_INFO.onekey.icon,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
190
199
|
if ((0, cross_inpage_provider_core_1.checkWalletSwitchEnable)()) {
|
|
191
200
|
(0, onekey_polkadot_provider_1.registerPolkadot)(polkadot);
|
|
192
201
|
}
|
|
@@ -200,4 +209,3 @@ function injectWeb3Provider() {
|
|
|
200
209
|
}, 1000);
|
|
201
210
|
return $onekey;
|
|
202
211
|
}
|
|
203
|
-
exports.injectWeb3Provider = injectWeb3Provider;
|
|
@@ -66,23 +66,23 @@ function getEnabledProviders({ providers, }) {
|
|
|
66
66
|
return checkIfInjectedProviderEnable({ providerName });
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
export function detectQrcodeFromSvg(
|
|
70
|
-
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
export function detectQrcodeFromSvg(_a) {
|
|
70
|
+
return __awaiter(this, arguments, void 0, function* ({ img, }) {
|
|
72
71
|
// https://unpkg.com/qr-scanner@1.4.1/qr-scanner.umd.min.js
|
|
72
|
+
var _b, _c;
|
|
73
73
|
// Firefox does not support drawing SVG images to canvas
|
|
74
74
|
// Unless the svg file has width/height attributes on the root <svg> element
|
|
75
75
|
try {
|
|
76
76
|
img.setAttribute('width', img.clientWidth.toString());
|
|
77
77
|
img.setAttribute('height', img.clientHeight.toString());
|
|
78
78
|
}
|
|
79
|
-
catch (
|
|
79
|
+
catch (_d) {
|
|
80
80
|
//pass
|
|
81
81
|
}
|
|
82
82
|
const serialized = new XMLSerializer().serializeToString(img);
|
|
83
83
|
const encodedData = window.btoa(serialized);
|
|
84
84
|
const base64 = `data:image/svg+xml;base64,${encodedData}`;
|
|
85
|
-
const res = (yield ((
|
|
85
|
+
const res = (yield ((_c = (_b = window.$onekey) === null || _b === void 0 ? void 0 : _b.$private) === null || _c === void 0 ? void 0 : _c.request({
|
|
86
86
|
method: 'wallet_scanQrcode',
|
|
87
87
|
params: [{ base64 }],
|
|
88
88
|
})));
|
|
@@ -116,6 +116,10 @@ export function detectQrcodeFromSvg({ img, }) {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
return '';
|
|
119
|
+
// const res = await fetch(base64);
|
|
120
|
+
// const blob = await res.blob();
|
|
121
|
+
// const result = await barcodeDetector.detect(blob);
|
|
122
|
+
// return result?.[0]?.rawValue;
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
125
|
let isAddedRotateAnimation = false;
|
|
@@ -23,12 +23,12 @@ export default () => hackConnectButton({
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
replaceFunc({
|
|
26
|
-
findName: 'Metamask',
|
|
26
|
+
findName: 'Metamask', // Metamask MetaMask
|
|
27
27
|
icon: WALLET_CONNECT_INFO.metamask.icon,
|
|
28
28
|
text: WALLET_CONNECT_INFO.metamask.text,
|
|
29
29
|
});
|
|
30
30
|
replaceFunc({
|
|
31
|
-
findName: 'WalletConnect',
|
|
31
|
+
findName: 'WalletConnect', // Metamask MetaMask
|
|
32
32
|
icon: WALLET_CONNECT_INFO.walletconnect.icon,
|
|
33
33
|
text: WALLET_CONNECT_INFO.walletconnect.text,
|
|
34
34
|
});
|
|
@@ -3,8 +3,8 @@ import { hackConnectButton } from '../hackConnectButton';
|
|
|
3
3
|
import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
|
|
4
4
|
import { WALLET_CONNECT_INFO } from '../consts';
|
|
5
5
|
export default () => hackConnectButton({
|
|
6
|
-
urls: ['stake.lido.fi'],
|
|
7
|
-
providers: [IInjectedProviderNames.ethereum],
|
|
6
|
+
urls: ['stake.lido.fi'], // adapter to the site url, can have multiple urls.
|
|
7
|
+
providers: [IInjectedProviderNames.ethereum], // provider class, example: IInjectedProviderNames.ethereum、IInjectedProviderNames.btc
|
|
8
8
|
replaceMethod(options) {
|
|
9
9
|
var _a;
|
|
10
10
|
const replaceFunc = ({ findName, icon, text, }) => {
|
|
@@ -34,8 +34,8 @@ export default () => hackConnectButton({
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const { isExtension, isDesktop, isNative } = onekeyHub.$walletInfo.platformEnv;
|
|
37
|
-
const replaceFunc = (
|
|
38
|
-
var
|
|
37
|
+
const replaceFunc = (_a) => __awaiter(this, [_a], void 0, function* ({ findName, icon, text, }) {
|
|
38
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
39
39
|
const headerText = document.getElementById('walletconnect-qrcode-text');
|
|
40
40
|
if (!headerText) {
|
|
41
41
|
return;
|
|
@@ -45,7 +45,7 @@ export default () => hackConnectButton({
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
// **** android single connect button replacement
|
|
48
|
-
const isAndroidSingleConnectButton = (
|
|
48
|
+
const isAndroidSingleConnectButton = (_c = (_b = headerNextSibling === null || headerNextSibling === void 0 ? void 0 : headerNextSibling.classList) === null || _b === void 0 ? void 0 : _b.contains) === null || _c === void 0 ? void 0 : _c.call(_b, 'walletconnect-connect__buttons__wrapper__android');
|
|
49
49
|
if (isAndroidSingleConnectButton) {
|
|
50
50
|
const btn = headerNextSibling.querySelector('.walletconnect-connect__button');
|
|
51
51
|
if (!btn) {
|
|
@@ -63,8 +63,8 @@ export default () => hackConnectButton({
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
// **** deeplink buttons replacement
|
|
66
|
-
const isSearchInput = (
|
|
67
|
-
const isConnectButtonsContainer = (
|
|
66
|
+
const isSearchInput = (_e = (_d = headerNextSibling === null || headerNextSibling === void 0 ? void 0 : headerNextSibling.classList) === null || _d === void 0 ? void 0 : _d.contains) === null || _e === void 0 ? void 0 : _e.call(_d, 'walletconnect-search__input');
|
|
67
|
+
const isConnectButtonsContainer = (_g = (_f = headerNextSibling === null || headerNextSibling === void 0 ? void 0 : headerNextSibling.classList) === null || _f === void 0 ? void 0 : _f.contains) === null || _g === void 0 ? void 0 : _g.call(_f, 'walletconnect-connect__buttons__wrapper__wrap');
|
|
68
68
|
if (isSearchInput || isConnectButtonsContainer) {
|
|
69
69
|
const shouldHideOtherWallets = isDesktop || isNative;
|
|
70
70
|
const inputEle = isSearchInput ? headerNextSibling : undefined;
|
|
@@ -140,7 +140,7 @@ export default () => hackConnectButton({
|
|
|
140
140
|
// remove input and footer pagination
|
|
141
141
|
if (shouldHideOtherWallets) {
|
|
142
142
|
inputEle === null || inputEle === void 0 ? void 0 : inputEle.remove();
|
|
143
|
-
const footerContainer = (
|
|
143
|
+
const footerContainer = (_h = iconsContainer === null || iconsContainer === void 0 ? void 0 : iconsContainer.parentNode) === null || _h === void 0 ? void 0 : _h.querySelector('.walletconnect-modal__footer');
|
|
144
144
|
footerContainer === null || footerContainer === void 0 ? void 0 : footerContainer.remove();
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -5,7 +5,7 @@ export default () => hackConnectButton({
|
|
|
5
5
|
urls: ['zapper.xyz', 'zapper.fi', 'www.zapper.xyz'],
|
|
6
6
|
providers: [IInjectedProviderNames.ethereum],
|
|
7
7
|
mutationObserverOptions: {
|
|
8
|
-
attributes: true,
|
|
8
|
+
attributes: true, // shadowRoot changed watch required
|
|
9
9
|
characterData: false,
|
|
10
10
|
childList: true,
|
|
11
11
|
subtree: true,
|
|
@@ -925,7 +925,7 @@ export const sitesConfig = [
|
|
|
925
925
|
},
|
|
926
926
|
},
|
|
927
927
|
{
|
|
928
|
-
urls: ['exchange.idex.io'],
|
|
928
|
+
urls: ['exchange.idex.io'], //not existed?
|
|
929
929
|
testPath: {
|
|
930
930
|
desktop: [':text("Get Started")', ':text("Connect Wallet")'],
|
|
931
931
|
mobile: [':text("Get Started")', ':text("Connect")'],
|
|
@@ -1131,7 +1131,7 @@ export const sitesConfig = [
|
|
|
1131
1131
|
},
|
|
1132
1132
|
{
|
|
1133
1133
|
urls: ['www.convexfinance.com'],
|
|
1134
|
-
skip: true,
|
|
1134
|
+
skip: true, //no icon
|
|
1135
1135
|
walletsForProvider: {
|
|
1136
1136
|
[IInjectedProviderNames.ethereum]: [
|
|
1137
1137
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { update({ updatedName, name }) {
|
|
@@ -1188,7 +1188,7 @@ export const sitesConfig = [
|
|
|
1188
1188
|
},
|
|
1189
1189
|
{
|
|
1190
1190
|
urls: ['task.bsquared.network'],
|
|
1191
|
-
skip: { mobile: true },
|
|
1191
|
+
skip: { mobile: true }, //warn:mobile is not supported by the site
|
|
1192
1192
|
walletsForProvider: {
|
|
1193
1193
|
[IInjectedProviderNames.ethereum]: [
|
|
1194
1194
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: () => getConnectWalletModalByTitle('.ReactModal__Content', 'Please Connect A Wallet') }),
|
|
@@ -1302,7 +1302,7 @@ export const sitesConfig = [
|
|
|
1302
1302
|
desktop: [':text("Connect Wallet")'],
|
|
1303
1303
|
mobile: ['header.flex > button>svg', ':text("Connect Wallet")'],
|
|
1304
1304
|
},
|
|
1305
|
-
skip: true,
|
|
1305
|
+
skip: true, //temp skip
|
|
1306
1306
|
walletsForProvider: {
|
|
1307
1307
|
[IInjectedProviderNames.cardano]: [
|
|
1308
1308
|
Object.assign(Object.assign({}, basicWalletInfo['nami']), { findIconAndName({ name }) {
|
|
@@ -1589,7 +1589,7 @@ export const sitesConfig = [
|
|
|
1589
1589
|
},
|
|
1590
1590
|
{
|
|
1591
1591
|
urls: ['app.milkyway.zone'],
|
|
1592
|
-
skip: { mobile: true },
|
|
1592
|
+
skip: { mobile: true }, //WARN: mobile is not supported by the site
|
|
1593
1593
|
walletsForProvider: {
|
|
1594
1594
|
[IInjectedProviderNames.cosmos]: [
|
|
1595
1595
|
Object.assign(Object.assign({}, basicWalletInfo['keplr']), { name: /^(Keplr|Keplr Mobile)$/i, container: 'div[aria-label="wallet list"][role="list"]' }),
|
|
@@ -1675,7 +1675,7 @@ export const sitesConfig = [
|
|
|
1675
1675
|
],
|
|
1676
1676
|
desktop: ['.proceed-cta-checkbox input', 'button:text("Proceed")', ':text("Connect Wallet")'],
|
|
1677
1677
|
},
|
|
1678
|
-
skip: { mobile: true },
|
|
1678
|
+
skip: { mobile: true }, //input click not work
|
|
1679
1679
|
constraintMap: { icon: [isWalletIconLessEqualThan], text: [] },
|
|
1680
1680
|
walletsForProvider: {
|
|
1681
1681
|
[IInjectedProviderNames.ethereum]: [
|
|
@@ -1688,7 +1688,7 @@ export const sitesConfig = [
|
|
|
1688
1688
|
},
|
|
1689
1689
|
{
|
|
1690
1690
|
urls: ['app.mai.finance'],
|
|
1691
|
-
skip: { mobile: true },
|
|
1691
|
+
skip: { mobile: true }, //it seems mobile is not supported
|
|
1692
1692
|
walletsForProvider: {
|
|
1693
1693
|
[IInjectedProviderNames.ethereum]: [
|
|
1694
1694
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'button#connect-METAMASK' }),
|
|
@@ -1892,7 +1892,7 @@ export const sitesConfig = [
|
|
|
1892
1892
|
},
|
|
1893
1893
|
{
|
|
1894
1894
|
urls: ['v2.sturdy.finance'],
|
|
1895
|
-
skip: { mobile: true },
|
|
1895
|
+
skip: { mobile: true }, //there is no entry for connect wallet
|
|
1896
1896
|
walletsForProvider: {
|
|
1897
1897
|
[IInjectedProviderNames.ethereum]: [
|
|
1898
1898
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: () => getConnectWalletModalByTitle('div[role="dialog"]', 'Connect a wallet') }),
|
|
@@ -2017,7 +2017,7 @@ export const sitesConfig = [
|
|
|
2017
2017
|
},
|
|
2018
2018
|
{
|
|
2019
2019
|
urls: ['stake.anvm.io'],
|
|
2020
|
-
skip: { mobile: true },
|
|
2020
|
+
skip: { mobile: true }, //unistat is offline
|
|
2021
2021
|
testPath: {
|
|
2022
2022
|
desktop: [':text("Connect Wallet")', ':nth-match(button.rounded-full:text("Connect"),2)'],
|
|
2023
2023
|
'mobile': [
|
|
@@ -2055,14 +2055,14 @@ export const sitesConfig = [
|
|
|
2055
2055
|
},
|
|
2056
2056
|
{
|
|
2057
2057
|
urls: ['app.gyro.finance'],
|
|
2058
|
-
skip: { mobile: true },
|
|
2058
|
+
skip: { mobile: true }, //not supported by mobile
|
|
2059
2059
|
walletsForProvider: {
|
|
2060
2060
|
[IInjectedProviderNames.ethereum]: [metamaskForRainbowKit, walletConnectForRainbowKit],
|
|
2061
2061
|
},
|
|
2062
2062
|
},
|
|
2063
2063
|
{
|
|
2064
2064
|
urls: ['app.reflexer.finance'],
|
|
2065
|
-
skip: { mobile: true },
|
|
2065
|
+
skip: { mobile: true }, //no item in wallet list
|
|
2066
2066
|
constraintMap: { icon: [isWalletIconLessEqualThan], text: [] },
|
|
2067
2067
|
walletsForProvider: {
|
|
2068
2068
|
[IInjectedProviderNames.ethereum]: [
|
|
@@ -2404,7 +2404,7 @@ export const sitesConfig = [
|
|
|
2404
2404
|
},
|
|
2405
2405
|
{
|
|
2406
2406
|
urls: ['app.pstake.finance'],
|
|
2407
|
-
skip: true,
|
|
2407
|
+
skip: true, //too slow
|
|
2408
2408
|
testUrls: ['app.pstake.finance/cosmos'],
|
|
2409
2409
|
walletsForProvider: {
|
|
2410
2410
|
[IInjectedProviderNames.cosmos]: [
|
|
@@ -2416,7 +2416,7 @@ export const sitesConfig = [
|
|
|
2416
2416
|
},
|
|
2417
2417
|
{
|
|
2418
2418
|
urls: ['solo.top'],
|
|
2419
|
-
skip: { mobile: true },
|
|
2419
|
+
skip: { mobile: true }, //no metamask on mobile
|
|
2420
2420
|
constraintMap: { icon: [isWalletIconLessEqualThan], text: [] },
|
|
2421
2421
|
walletsForProvider: {
|
|
2422
2422
|
[IInjectedProviderNames.ethereum]: [
|
|
@@ -4,7 +4,7 @@ import { Selector } from './type';
|
|
|
4
4
|
export declare const universalLog: Logger;
|
|
5
5
|
export declare function isClickable(ele: HTMLElement): boolean;
|
|
6
6
|
export declare const getWalletListByBtn: (anyButtonSelector: Selector) => HTMLElement | null;
|
|
7
|
-
export declare const getConnectWalletModalByTitle: (modalSelector: Selector | Selector[], title: string | string[], filter?: (
|
|
7
|
+
export declare const getConnectWalletModalByTitle: (modalSelector: Selector | Selector[], title: string | string[], filter?: (modal: HTMLElement) => boolean) => HTMLElement | null;
|
|
8
8
|
export declare function isInExternalLink(element: HTMLElement, container: HTMLElement): boolean;
|
|
9
9
|
export declare function isVisible(ele: HTMLElement): boolean;
|
|
10
10
|
export declare function createWalletId(provider: IInjectedProviderNames, updatedName: string): {
|
|
@@ -7,6 +7,7 @@ import { ProviderAlph } from '@onekeyfe/onekey-alph-provider';
|
|
|
7
7
|
import { ProviderCardano } from '@onekeyfe/onekey-cardano-provider';
|
|
8
8
|
import { ProviderCosmos } from '@onekeyfe/onekey-cosmos-provider';
|
|
9
9
|
import { ProviderSui } from '@onekeyfe/onekey-sui-provider';
|
|
10
|
+
import { ProviderBfc } from '@onekeyfe/onekey-bfc-provider';
|
|
10
11
|
import { ProviderWebln } from '@onekeyfe/onekey-webln-provider';
|
|
11
12
|
import { ProviderScdo } from '@onekeyfe/onekey-scdo-provider';
|
|
12
13
|
import { ProviderTon } from '@onekeyfe/onekey-ton-provider';
|
|
@@ -24,6 +25,7 @@ export type IWindowOneKeyHub = {
|
|
|
24
25
|
petra?: ProviderAptos;
|
|
25
26
|
martian?: ProviderAptosMartian;
|
|
26
27
|
suiWallet?: ProviderSui;
|
|
28
|
+
bfcWallet?: ProviderBfc;
|
|
27
29
|
cardano?: ProviderCardano;
|
|
28
30
|
keplr?: ProviderCosmos;
|
|
29
31
|
webln?: ProviderWebln;
|
|
@@ -7,11 +7,11 @@ import { ProviderConflux } from '@onekeyfe/onekey-conflux-provider';
|
|
|
7
7
|
import { ProviderAlph, registerAlephiumProvider } from '@onekeyfe/onekey-alph-provider';
|
|
8
8
|
import { ProviderTron } from '@onekeyfe/onekey-tron-provider';
|
|
9
9
|
import { ProviderCardano, defineWindowCardanoProperty } from '@onekeyfe/onekey-cardano-provider';
|
|
10
|
-
// import { ProviderPrivateExternalAccount } from '@onekeyfe/onekey-private-external-account-provider';
|
|
11
10
|
import { ProviderCosmos } from '@onekeyfe/onekey-cosmos-provider';
|
|
12
11
|
import { ProviderPolkadot, registerPolkadot } from '@onekeyfe/onekey-polkadot-provider';
|
|
13
12
|
import { defineWindowProperty, checkWalletSwitchEnable, } from '@onekeyfe/cross-inpage-provider-core';
|
|
14
13
|
import { ProviderSui, registerSuiWallet } from '@onekeyfe/onekey-sui-provider';
|
|
14
|
+
import { ProviderBfc, registerBfcWallet } from '@onekeyfe/onekey-bfc-provider';
|
|
15
15
|
import { ProviderWebln } from '@onekeyfe/onekey-webln-provider';
|
|
16
16
|
import { ProviderScdo } from '@onekeyfe/onekey-scdo-provider';
|
|
17
17
|
import { createTonProviderOpenMask, ProviderTon } from '@onekeyfe/onekey-ton-provider';
|
|
@@ -51,6 +51,9 @@ function injectWeb3Provider() {
|
|
|
51
51
|
const sui = new ProviderSui({
|
|
52
52
|
bridge,
|
|
53
53
|
});
|
|
54
|
+
const bfc = new ProviderBfc({
|
|
55
|
+
bridge,
|
|
56
|
+
});
|
|
54
57
|
const cardano = new ProviderCardano({
|
|
55
58
|
bridge,
|
|
56
59
|
});
|
|
@@ -76,15 +79,14 @@ function injectWeb3Provider() {
|
|
|
76
79
|
const btcWallet = new ProviderBtcWallet({ bridge });
|
|
77
80
|
const algorand = new ProviderAlgo({ bridge });
|
|
78
81
|
const scdo = new ProviderScdo({ bridge });
|
|
79
|
-
// const $privateExternalAccount = new ProviderPrivateExternalAccount({ bridge });
|
|
80
82
|
// providerHub
|
|
81
83
|
const $onekey = Object.assign(Object.assign({}, window.$onekey), { jsBridge: bridge, $private,
|
|
82
|
-
// $privateExternalAccount,
|
|
83
84
|
ethereum,
|
|
84
85
|
solana,
|
|
85
86
|
// starcoin,
|
|
86
87
|
aptos: martian, conflux,
|
|
87
88
|
tron, sollet: null, sui,
|
|
89
|
+
bfc,
|
|
88
90
|
tonconnect,
|
|
89
91
|
cardano,
|
|
90
92
|
alephium,
|
|
@@ -131,6 +133,7 @@ function injectWeb3Provider() {
|
|
|
131
133
|
registerAlephiumProvider(alephium);
|
|
132
134
|
defineWindowProperty('tronLink', tron);
|
|
133
135
|
defineWindowProperty('suiWallet', sui);
|
|
136
|
+
defineWindowProperty('bfcWallet', bfc);
|
|
134
137
|
defineWindowProperty('onekeyTonWallet', {
|
|
135
138
|
tonconnect,
|
|
136
139
|
});
|
|
@@ -184,6 +187,12 @@ function injectWeb3Provider() {
|
|
|
184
187
|
logo: WALLET_CONNECT_INFO.onekey.icon,
|
|
185
188
|
});
|
|
186
189
|
}
|
|
190
|
+
// BFC Standard Wallet
|
|
191
|
+
if (checkWalletSwitchEnable()) {
|
|
192
|
+
registerBfcWallet(bfc, {
|
|
193
|
+
logo: WALLET_CONNECT_INFO.onekey.icon,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
187
196
|
if (checkWalletSwitchEnable()) {
|
|
188
197
|
registerPolkadot(polkadot);
|
|
189
198
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/inpage-providers-hub",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.18",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -30,26 +30,26 @@
|
|
|
30
30
|
"start": "tsc --watch"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-core": "2.1.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "2.1.
|
|
35
|
-
"@onekeyfe/onekey-algo-provider": "2.1.
|
|
36
|
-
"@onekeyfe/onekey-alph-provider": "2.1.
|
|
37
|
-
"@onekeyfe/onekey-aptos-provider": "2.1.
|
|
38
|
-
"@onekeyfe/onekey-
|
|
39
|
-
"@onekeyfe/onekey-
|
|
40
|
-
"@onekeyfe/onekey-
|
|
41
|
-
"@onekeyfe/onekey-
|
|
42
|
-
"@onekeyfe/onekey-
|
|
43
|
-
"@onekeyfe/onekey-
|
|
44
|
-
"@onekeyfe/onekey-
|
|
45
|
-
"@onekeyfe/onekey-
|
|
46
|
-
"@onekeyfe/onekey-private-provider": "2.1.
|
|
47
|
-
"@onekeyfe/onekey-scdo-provider": "2.1.
|
|
48
|
-
"@onekeyfe/onekey-solana-provider": "2.1.
|
|
49
|
-
"@onekeyfe/onekey-sui-provider": "2.1.
|
|
50
|
-
"@onekeyfe/onekey-ton-provider": "2.1.
|
|
51
|
-
"@onekeyfe/onekey-tron-provider": "2.1.
|
|
52
|
-
"@onekeyfe/onekey-webln-provider": "2.1.
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-core": "2.1.18",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "2.1.18",
|
|
35
|
+
"@onekeyfe/onekey-algo-provider": "2.1.18",
|
|
36
|
+
"@onekeyfe/onekey-alph-provider": "2.1.18",
|
|
37
|
+
"@onekeyfe/onekey-aptos-provider": "2.1.18",
|
|
38
|
+
"@onekeyfe/onekey-bfc-provider": "2.1.18",
|
|
39
|
+
"@onekeyfe/onekey-btc-provider": "2.1.18",
|
|
40
|
+
"@onekeyfe/onekey-cardano-provider": "2.1.18",
|
|
41
|
+
"@onekeyfe/onekey-conflux-provider": "2.1.18",
|
|
42
|
+
"@onekeyfe/onekey-cosmos-provider": "2.1.18",
|
|
43
|
+
"@onekeyfe/onekey-eth-provider": "2.1.18",
|
|
44
|
+
"@onekeyfe/onekey-nostr-provider": "2.1.18",
|
|
45
|
+
"@onekeyfe/onekey-polkadot-provider": "2.1.18",
|
|
46
|
+
"@onekeyfe/onekey-private-provider": "2.1.18",
|
|
47
|
+
"@onekeyfe/onekey-scdo-provider": "2.1.18",
|
|
48
|
+
"@onekeyfe/onekey-solana-provider": "2.1.18",
|
|
49
|
+
"@onekeyfe/onekey-sui-provider": "2.1.18",
|
|
50
|
+
"@onekeyfe/onekey-ton-provider": "2.1.18",
|
|
51
|
+
"@onekeyfe/onekey-tron-provider": "2.1.18",
|
|
52
|
+
"@onekeyfe/onekey-webln-provider": "2.1.18",
|
|
53
53
|
"web3": "^1.7.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"@types/node": "^20.12.7",
|
|
58
58
|
"playwright": "^1.43.1"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "37fa1037312327275e28c3acea89fd2110430328"
|
|
61
61
|
}
|