@onekeyfe/inpage-providers-hub 2.2.14 → 2.2.17

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.
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const hackConnectButton_1 = require("../hackConnectButton");
7
- const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
8
- const consts_1 = require("../consts");
9
- const utilsDomNodes_1 = __importDefault(require("../utils/utilsDomNodes"));
10
- exports.default = () => (0, hackConnectButton_1.hackConnectButton)({
11
- urls: ['app.solv.finance'],
12
- providers: [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum],
13
- replaceMethod(options) {
14
- var _a;
15
- const replaceFunc = ({ findName, icon, text, }) => {
16
- const walletBtnList = Array.from(document.querySelectorAll('[role="dialog"] > div:nth-child(2).overflow-y-overlay > div > div:nth-child(2) >div'));
17
- for (const walletBtn of walletBtnList) {
18
- if ((walletBtn === null || walletBtn === void 0 ? void 0 : walletBtn.innerText) === findName) {
19
- const textNode = utilsDomNodes_1.default.findTextNode(walletBtn, findName);
20
- textNode === null || textNode === void 0 ? void 0 : textNode.replaceWith(text);
21
- const img = walletBtn === null || walletBtn === void 0 ? void 0 : walletBtn.querySelector(':scope > div:nth-child(1) > span> img');
22
- if (img) {
23
- img.src = icon;
24
- img.style.width = '32px';
25
- img.style.height = '32px';
26
- img.style.minWidth = 'auto';
27
- img.style.minHeight = 'auto';
28
- }
29
- }
30
- }
31
- };
32
- if ((_a = options === null || options === void 0 ? void 0 : options.providers) === null || _a === void 0 ? void 0 : _a.includes(cross_inpage_provider_types_1.IInjectedProviderNames.ethereum)) {
33
- replaceFunc({
34
- findName: 'MetaMask',
35
- icon: consts_1.WALLET_CONNECT_INFO.metamask.icon,
36
- text: consts_1.WALLET_CONNECT_INFO.metamask.text,
37
- });
38
- replaceFunc({
39
- findName: 'Wallet Connect',
40
- icon: consts_1.WALLET_CONNECT_INFO.walletconnect.icon,
41
- text: consts_1.WALLET_CONNECT_INFO.walletconnect.text,
42
- });
43
- }
44
- },
45
- });
@@ -1,2 +0,0 @@
1
- declare const _default: () => void;
2
- export default _default;
@@ -1,53 +0,0 @@
1
- import { createNewImageToContainer, hackConnectButton } from '../hackConnectButton';
2
- import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
3
- import { WALLET_CONNECT_INFO } from '../consts';
4
- export default () => hackConnectButton({
5
- urls: ['stake.lido.fi'],
6
- providers: [IInjectedProviderNames.ethereum],
7
- replaceMethod(options) {
8
- var _a;
9
- const replaceFunc = ({ findName, icon, text, }) => {
10
- var _a, _b;
11
- const buttons = Array.from((_b = (_a = document.querySelector('div.idjqeC')) === null || _a === void 0 ? void 0 : _a.querySelectorAll('button')) !== null && _b !== void 0 ? _b : []);
12
- const findButton = buttons.find((button) => {
13
- const span = button.querySelector('span > span > div');
14
- if (span && span.innerText === findName) {
15
- return button;
16
- }
17
- return undefined;
18
- });
19
- if (findButton) {
20
- // change button text
21
- const span = findButton.querySelector('div');
22
- if (span) {
23
- span.innerText = text;
24
- }
25
- // change icon
26
- const imgContainer = findButton.querySelector('span > span >span');
27
- if (imgContainer) {
28
- createNewImageToContainer({
29
- container: imgContainer,
30
- icon: icon,
31
- removeSvg: true,
32
- onCreated(img) {
33
- img.style.maxWidth = '48px';
34
- img.style.maxHeight = '48px';
35
- },
36
- });
37
- }
38
- }
39
- };
40
- if ((_a = options === null || options === void 0 ? void 0 : options.providers) === null || _a === void 0 ? void 0 : _a.includes(IInjectedProviderNames.ethereum)) {
41
- replaceFunc({
42
- findName: 'MetaMask',
43
- icon: WALLET_CONNECT_INFO.metamask.icon,
44
- text: WALLET_CONNECT_INFO.metamask.text,
45
- });
46
- replaceFunc({
47
- findName: 'WalletConnect',
48
- icon: WALLET_CONNECT_INFO.walletconnect.icon,
49
- text: WALLET_CONNECT_INFO.walletconnect.text,
50
- });
51
- }
52
- },
53
- });
@@ -1,2 +0,0 @@
1
- declare const _default: () => void;
2
- export default _default;
@@ -1,37 +0,0 @@
1
- import { hackConnectButton } from '../hackConnectButton';
2
- import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
3
- import { WALLET_CONNECT_INFO } from '../consts';
4
- export default () => hackConnectButton({
5
- urls: ['stake.rocketpool.net'],
6
- providers: [IInjectedProviderNames.ethereum],
7
- replaceMethod(options) {
8
- var _a;
9
- const replaceFunc = ({ findName, icon, text, }) => {
10
- const walletBtnList = Array.from(document.querySelectorAll(`#headlessui-portal-root [role="dialog"] ul li`));
11
- for (const walletBtn of walletBtnList) {
12
- if ((walletBtn === null || walletBtn === void 0 ? void 0 : walletBtn.innerText) === findName) {
13
- const textNode = walletBtn === null || walletBtn === void 0 ? void 0 : walletBtn.querySelector('div span');
14
- if (textNode) {
15
- textNode.innerText = text;
16
- }
17
- const img = walletBtn === null || walletBtn === void 0 ? void 0 : walletBtn.querySelector('img');
18
- if (img) {
19
- img.src = icon; //keep the original size and style
20
- }
21
- }
22
- }
23
- };
24
- if ((_a = options === null || options === void 0 ? void 0 : options.providers) === null || _a === void 0 ? void 0 : _a.includes(IInjectedProviderNames.ethereum)) {
25
- replaceFunc({
26
- findName: 'Metamask',
27
- icon: WALLET_CONNECT_INFO.metamask.icon,
28
- text: WALLET_CONNECT_INFO.metamask.text,
29
- });
30
- replaceFunc({
31
- findName: 'Wallet Connect',
32
- icon: WALLET_CONNECT_INFO.walletconnect.icon,
33
- text: WALLET_CONNECT_INFO.walletconnect.text,
34
- });
35
- }
36
- },
37
- });
@@ -1,2 +0,0 @@
1
- declare const _default: () => void;
2
- export default _default;
@@ -1,40 +0,0 @@
1
- import { hackConnectButton } from '../hackConnectButton';
2
- import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
3
- import { WALLET_CONNECT_INFO } from '../consts';
4
- import domUtils from '../utils/utilsDomNodes';
5
- export default () => hackConnectButton({
6
- urls: ['app.solv.finance'],
7
- providers: [IInjectedProviderNames.ethereum],
8
- replaceMethod(options) {
9
- var _a;
10
- const replaceFunc = ({ findName, icon, text, }) => {
11
- const walletBtnList = Array.from(document.querySelectorAll('[role="dialog"] > div:nth-child(2).overflow-y-overlay > div > div:nth-child(2) >div'));
12
- for (const walletBtn of walletBtnList) {
13
- if ((walletBtn === null || walletBtn === void 0 ? void 0 : walletBtn.innerText) === findName) {
14
- const textNode = domUtils.findTextNode(walletBtn, findName);
15
- textNode === null || textNode === void 0 ? void 0 : textNode.replaceWith(text);
16
- const img = walletBtn === null || walletBtn === void 0 ? void 0 : walletBtn.querySelector(':scope > div:nth-child(1) > span> img');
17
- if (img) {
18
- img.src = icon;
19
- img.style.width = '32px';
20
- img.style.height = '32px';
21
- img.style.minWidth = 'auto';
22
- img.style.minHeight = 'auto';
23
- }
24
- }
25
- }
26
- };
27
- if ((_a = options === null || options === void 0 ? void 0 : options.providers) === null || _a === void 0 ? void 0 : _a.includes(IInjectedProviderNames.ethereum)) {
28
- replaceFunc({
29
- findName: 'MetaMask',
30
- icon: WALLET_CONNECT_INFO.metamask.icon,
31
- text: WALLET_CONNECT_INFO.metamask.text,
32
- });
33
- replaceFunc({
34
- findName: 'Wallet Connect',
35
- icon: WALLET_CONNECT_INFO.walletconnect.icon,
36
- text: WALLET_CONNECT_INFO.walletconnect.text,
37
- });
38
- }
39
- },
40
- });