@onekeyfe/inpage-providers-hub 2.2.6 → 2.2.7-alpha.1

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.
@@ -14,7 +14,7 @@ exports.createWalletConnectToButton = createWalletConnectToButton;
14
14
  exports.createNewImageToContainer = createNewImageToContainer;
15
15
  exports.hackConnectButton = hackConnectButton;
16
16
  const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-core");
17
- const lodash_1 = require("lodash");
17
+ const lodash_es_1 = require("lodash-es");
18
18
  const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
19
19
  const hackButtonLogger = new cross_inpage_provider_core_1.Logger('hackButton');
20
20
  function checkIfInjectedProviderConnected({ providerName, }) {
@@ -268,7 +268,7 @@ function hackConnectButton({ urls, replaceMethod, providers, mutationObserverOpt
268
268
  // Options for the observer (which mutations to observe)
269
269
  const config = mutationObserverOptions;
270
270
  // Callback function to execute when mutations are observed
271
- const callback = (0, lodash_1.throttle)((mutationList, observer) => {
271
+ const callback = (0, lodash_es_1.throttle)((mutationList, observer) => {
272
272
  setTimeout(() => {
273
273
  var _a, _b;
274
274
  try {
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const hackConnectButton_1 = require("../hackConnectButton");
4
4
  const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
5
5
  const consts_1 = require("../consts");
6
- const lodash_1 = require("lodash");
6
+ const lodash_es_1 = require("lodash-es");
7
7
  exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
8
8
  urls: ['aave.com', 'app.aave.com', 'www.aave.com'],
9
9
  providers: [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum],
10
10
  replaceMethod() {
11
11
  const replaceFunc = ({ findName, findIcon, icon, text, }) => {
12
12
  var _a;
13
- const img = (0, lodash_1.last)(Array.from(document.querySelectorAll(`.MuiModal-root button>span>img[src="${findIcon || ''}"]`)));
13
+ const img = (0, lodash_es_1.last)(Array.from(document.querySelectorAll(`.MuiModal-root button>span>img[src="${findIcon || ''}"]`)));
14
14
  if (img && img.src) {
15
15
  img.src = icon;
16
16
  const span = (_a = img === null || img === void 0 ? void 0 : img.parentNode) === null || _a === void 0 ? void 0 : _a.previousSibling;
@@ -111,6 +111,7 @@ const petraForRainbowKit = Object.assign(Object.assign({}, exports.basicWalletIn
111
111
  } });
112
112
  exports.sitesConfig = [
113
113
  {
114
+ // only: true,
114
115
  urls: ['app.turbos.finance'],
115
116
  testPath: [':text("I accept the")', ':text("Continue")', ':text("Connect Wallet")'],
116
117
  walletsForProvider: {
@@ -120,6 +121,7 @@ exports.sitesConfig = [
120
121
  },
121
122
  },
122
123
  {
124
+ // only: true,
123
125
  urls: ['app.defisaver.com'],
124
126
  testPath: ['button:text("ACCEPT")'],
125
127
  walletsForProvider: {
@@ -134,6 +136,7 @@ exports.sitesConfig = [
134
136
  },
135
137
  },
136
138
  {
139
+ // only: true,
137
140
  urls: ['haedal.xyz'],
138
141
  testPath: [':text("Stake Now")', ':text("Connect Wallet")'],
139
142
  walletsForProvider: {
@@ -62,6 +62,7 @@ function isVisible(ele) {
62
62
  }
63
63
  function createWalletId(provider, updatedName) {
64
64
  const walletId = `${provider}-${updatedName.replace(/[\s&.]/g, '').toLowerCase()}`.replace(/onekey/i, 'onekey-');
65
+ // data-wallet-id="ethereum-onekey-metamask"
65
66
  const walletIdSelector = `[data-wallet-id="${walletId}"]`;
66
67
  return {
67
68
  walletId,
@@ -222,7 +222,8 @@ function SecurityInfo({ securityInfo, onClose, }) {
222
222
  }, children: (0, jsx_runtime_1.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2ZM0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10Z", fill: "black", "fill-opacity": "0.447" }), (0, jsx_runtime_1.jsx)("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 7C9.62267 7 9.29263 7.2086 9.12147 7.52152C8.85645 8.00606 8.24881 8.18401 7.76426 7.91899C7.27972 7.65396 7.10177 7.04632 7.36679 6.56178C7.87463 5.63331 8.86263 5 10 5C11.5147 5 12.5669 6.00643 12.8664 7.189C13.1676 8.37786 12.7101 9.76299 11.3416 10.4472C11.1323 10.5519 11 10.7659 11 11C11 11.5523 10.5523 12 10 12C9.44772 12 9 11.5523 9 11C9 10.0084 9.56027 9.10183 10.4472 8.65836C10.902 8.43099 11.0188 8.03973 10.9277 7.6801C10.835 7.31417 10.5283 7 10 7Z", fill: "black", "fill-opacity": "0.447" }), (0, jsx_runtime_1.jsx)("path", { d: "M11 14C11 14.5523 10.5523 15 10 15C9.44772 15 9 14.5523 9 14C9 13.4477 9.44772 13 10 13C10.5523 13 11 13.4477 11 14Z", fill: "black", "fill-opacity": "0.447" })] }) })), (0, jsx_runtime_1.jsx)("span", { style: {
223
223
  width: '100%',
224
224
  overflow: 'hidden',
225
- textOverflow: 'ellipsis'
225
+ textOverflow: 'ellipsis',
226
+ color: 'rgba(0, 0, 0, 0.88)',
226
227
  }, children: ((_c = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _c === void 0 ? void 0 : _c.name) || (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.host) })] }), (0, jsx_runtime_1.jsx)("div", { style: {
227
228
  display: 'flex',
228
229
  width: '24',
package/dist/cjs/index.js CHANGED
@@ -14,4 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.connectButtonData = void 0;
18
+ const config_1 = require("./connectButtonHack/universal/config");
19
+ const utils_1 = require("./connectButtonHack/universal/utils");
20
+ exports.connectButtonData = {
21
+ sitesConfig: config_1.sitesConfig,
22
+ createWalletId: utils_1.createWalletId,
23
+ };
17
24
  __exportStar(require("./injectWeb3Provider"), exports);
@@ -1,4 +1,4 @@
1
- import { ThrottleSettings } from 'lodash';
1
+ import { ThrottleSettings } from 'lodash-es';
2
2
  import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
3
3
  export declare function detectQrcodeFromSvg({ img, }: {
4
4
  img: HTMLImageElement | Element;
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { ISpecialPropertyProviderNamesReflection, Logger, checkWalletSwitchEnable, } from '@onekeyfe/cross-inpage-provider-core';
11
- import { throttle } from 'lodash';
11
+ import { throttle } from 'lodash-es';
12
12
  import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
13
13
  const hackButtonLogger = new Logger('hackButton');
14
14
  function checkIfInjectedProviderConnected({ providerName, }) {
@@ -1,7 +1,7 @@
1
1
  import { hackConnectButton } from '../hackConnectButton';
2
2
  import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
3
3
  import { WALLET_CONNECT_INFO } from '../consts';
4
- import { last } from 'lodash';
4
+ import { last } from 'lodash-es';
5
5
  export default () => hackConnectButton({
6
6
  urls: ['aave.com', 'app.aave.com', 'www.aave.com'],
7
7
  providers: [IInjectedProviderNames.ethereum],
@@ -105,6 +105,7 @@ const petraForRainbowKit = Object.assign(Object.assign({}, basicWalletInfo[WALLE
105
105
  } });
106
106
  export const sitesConfig = [
107
107
  {
108
+ // only: true,
108
109
  urls: ['app.turbos.finance'],
109
110
  testPath: [':text("I accept the")', ':text("Continue")', ':text("Connect Wallet")'],
110
111
  walletsForProvider: {
@@ -114,6 +115,7 @@ export const sitesConfig = [
114
115
  },
115
116
  },
116
117
  {
118
+ // only: true,
117
119
  urls: ['app.defisaver.com'],
118
120
  testPath: ['button:text("ACCEPT")'],
119
121
  walletsForProvider: {
@@ -128,6 +130,7 @@ export const sitesConfig = [
128
130
  },
129
131
  },
130
132
  {
133
+ // only: true,
131
134
  urls: ['haedal.xyz'],
132
135
  testPath: [':text("Stake Now")', ':text("Connect Wallet")'],
133
136
  walletsForProvider: {
@@ -50,6 +50,7 @@ export function isVisible(ele) {
50
50
  }
51
51
  export function createWalletId(provider, updatedName) {
52
52
  const walletId = `${provider}-${updatedName.replace(/[\s&.]/g, '').toLowerCase()}`.replace(/onekey/i, 'onekey-');
53
+ // data-wallet-id="ethereum-onekey-metamask"
53
54
  const walletIdSelector = `[data-wallet-id="${walletId}"]`;
54
55
  return {
55
56
  walletId,
@@ -219,7 +219,8 @@ function SecurityInfo({ securityInfo, onClose, }) {
219
219
  }, children: _jsxs("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2ZM0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10Z", fill: "black", "fill-opacity": "0.447" }), _jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 7C9.62267 7 9.29263 7.2086 9.12147 7.52152C8.85645 8.00606 8.24881 8.18401 7.76426 7.91899C7.27972 7.65396 7.10177 7.04632 7.36679 6.56178C7.87463 5.63331 8.86263 5 10 5C11.5147 5 12.5669 6.00643 12.8664 7.189C13.1676 8.37786 12.7101 9.76299 11.3416 10.4472C11.1323 10.5519 11 10.7659 11 11C11 11.5523 10.5523 12 10 12C9.44772 12 9 11.5523 9 11C9 10.0084 9.56027 9.10183 10.4472 8.65836C10.902 8.43099 11.0188 8.03973 10.9277 7.6801C10.835 7.31417 10.5283 7 10 7Z", fill: "black", "fill-opacity": "0.447" }), _jsx("path", { d: "M11 14C11 14.5523 10.5523 15 10 15C9.44772 15 9 14.5523 9 14C9 13.4477 9.44772 13 10 13C10.5523 13 11 13.4477 11 14Z", fill: "black", "fill-opacity": "0.447" })] }) })), _jsx("span", { style: {
220
220
  width: '100%',
221
221
  overflow: 'hidden',
222
- textOverflow: 'ellipsis'
222
+ textOverflow: 'ellipsis',
223
+ color: 'rgba(0, 0, 0, 0.88)',
223
224
  }, children: ((_c = securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.dapp) === null || _c === void 0 ? void 0 : _c.name) || (securityInfo === null || securityInfo === void 0 ? void 0 : securityInfo.host) })] }), _jsx("div", { style: {
224
225
  display: 'flex',
225
226
  width: '24',
package/dist/index.d.ts CHANGED
@@ -1 +1,6 @@
1
+ import { createWalletId } from './connectButtonHack/universal/utils';
2
+ export declare const connectButtonData: {
3
+ sitesConfig: import("./connectButtonHack/universal/config").SitesInfo[];
4
+ createWalletId: typeof createWalletId;
5
+ };
1
6
  export * from './injectWeb3Provider';
package/dist/index.js CHANGED
@@ -1 +1,7 @@
1
+ import { sitesConfig } from './connectButtonHack/universal/config';
2
+ import { createWalletId } from './connectButtonHack/universal/utils';
3
+ export const connectButtonData = {
4
+ sitesConfig,
5
+ createWalletId,
6
+ };
1
7
  export * from './injectWeb3Provider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/inpage-providers-hub",
3
- "version": "2.2.6",
3
+ "version": "2.2.7-alpha.1",
4
4
  "keywords": [
5
5
  "cross-inpage-provider"
6
6
  ],
@@ -25,38 +25,36 @@
25
25
  "scripts": {
26
26
  "prebuild": "rm -rf dist",
27
27
  "build": "tsc && tsc --project tsconfig.cjs.json",
28
- "test": "npx playwright test",
29
- "test:report": "npx playwright show-report reports",
30
28
  "start": "tsc --watch"
31
29
  },
32
30
  "dependencies": {
33
- "@onekeyfe/cross-inpage-provider-core": "2.2.6",
34
- "@onekeyfe/cross-inpage-provider-types": "2.2.6",
35
- "@onekeyfe/onekey-algo-provider": "2.2.6",
36
- "@onekeyfe/onekey-alph-provider": "2.2.6",
37
- "@onekeyfe/onekey-aptos-provider": "2.2.6",
38
- "@onekeyfe/onekey-bfc-provider": "2.2.6",
39
- "@onekeyfe/onekey-btc-provider": "2.2.6",
40
- "@onekeyfe/onekey-cardano-provider": "2.2.6",
41
- "@onekeyfe/onekey-conflux-provider": "2.2.6",
42
- "@onekeyfe/onekey-cosmos-provider": "2.2.6",
43
- "@onekeyfe/onekey-eth-provider": "2.2.6",
44
- "@onekeyfe/onekey-nostr-provider": "2.2.6",
45
- "@onekeyfe/onekey-polkadot-provider": "2.2.6",
46
- "@onekeyfe/onekey-private-provider": "2.2.6",
47
- "@onekeyfe/onekey-scdo-provider": "2.2.6",
48
- "@onekeyfe/onekey-solana-provider": "2.2.6",
49
- "@onekeyfe/onekey-sui-provider": "2.2.6",
50
- "@onekeyfe/onekey-ton-provider": "2.2.6",
51
- "@onekeyfe/onekey-tron-provider": "2.2.6",
52
- "@onekeyfe/onekey-webln-provider": "2.2.6",
31
+ "@onekeyfe/cross-inpage-provider-core": "2.2.7-alpha.1",
32
+ "@onekeyfe/cross-inpage-provider-types": "2.2.7-alpha.1",
33
+ "@onekeyfe/onekey-algo-provider": "2.2.7-alpha.1",
34
+ "@onekeyfe/onekey-alph-provider": "2.2.7-alpha.1",
35
+ "@onekeyfe/onekey-aptos-provider": "2.2.7-alpha.1",
36
+ "@onekeyfe/onekey-bfc-provider": "2.2.7-alpha.1",
37
+ "@onekeyfe/onekey-btc-provider": "2.2.7-alpha.1",
38
+ "@onekeyfe/onekey-cardano-provider": "2.2.7-alpha.1",
39
+ "@onekeyfe/onekey-conflux-provider": "2.2.7-alpha.1",
40
+ "@onekeyfe/onekey-cosmos-provider": "2.2.7-alpha.1",
41
+ "@onekeyfe/onekey-eth-provider": "2.2.7-alpha.1",
42
+ "@onekeyfe/onekey-nostr-provider": "2.2.7-alpha.1",
43
+ "@onekeyfe/onekey-polkadot-provider": "2.2.7-alpha.1",
44
+ "@onekeyfe/onekey-private-provider": "2.2.7-alpha.1",
45
+ "@onekeyfe/onekey-scdo-provider": "2.2.7-alpha.1",
46
+ "@onekeyfe/onekey-solana-provider": "2.2.7-alpha.1",
47
+ "@onekeyfe/onekey-sui-provider": "2.2.7-alpha.1",
48
+ "@onekeyfe/onekey-ton-provider": "2.2.7-alpha.1",
49
+ "@onekeyfe/onekey-tron-provider": "2.2.7-alpha.1",
50
+ "@onekeyfe/onekey-webln-provider": "2.2.7-alpha.1",
51
+ "lodash-es": "^4.17.21",
53
52
  "preact": "^10.25.1",
54
53
  "web3": "^1.7.3"
55
54
  },
56
55
  "devDependencies": {
57
- "@playwright/test": "^1.43.1",
58
- "@types/node": "^20.12.7",
59
- "playwright": "^1.43.1"
56
+ "@types/lodash-es": "^4.17.12",
57
+ "@types/node": "^20.12.7"
60
58
  },
61
- "gitHead": "e2eb8eab8cea220e8aca24859785047d3a0adee7"
59
+ "gitHead": "fd45c5d3afa44b7bfe1ca0642beb2b72557f0f73"
62
60
  }