@onekeyfe/inpage-providers-hub 2.2.56-alpha.2 → 2.2.57
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/builtInPerpInjected/hyperLiquidOneKeyWalletApi.js +26 -0
- package/dist/cjs/builtInPerpInjected/hyperLiquidOneKeyWalletApi.js +26 -0
- package/dist/cjs/connectButtonHack/universal/config.js +39 -0
- package/dist/cjs/connectButtonHack/universal/findIconAndName.js +32 -0
- package/dist/connectButtonHack/universal/config.js +40 -1
- package/dist/connectButtonHack/universal/findIconAndName.d.ts +4 -0
- package/dist/connectButtonHack/universal/findIconAndName.js +28 -0
- package/package.json +24 -24
|
@@ -55,6 +55,32 @@ function saveBuilderFeeConfigToStorage({ result, fromSource, }) {
|
|
|
55
55
|
console.error(error);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
if (result === null || result === void 0 ? void 0 : result.customLocalStorageV2) {
|
|
59
|
+
try {
|
|
60
|
+
Object.entries(result.customLocalStorageV2).forEach(([key, valueInfo]) => {
|
|
61
|
+
const { value, skipIfExists } = valueInfo || {};
|
|
62
|
+
try {
|
|
63
|
+
if (isString(value) && value && key) {
|
|
64
|
+
if (skipIfExists) {
|
|
65
|
+
const currentValue = localStorage.getItem(key);
|
|
66
|
+
if (currentValue === null || currentValue === undefined) {
|
|
67
|
+
localStorage.setItem(key, value);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
localStorage.setItem(key, value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error(error);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error(error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
58
84
|
if (result === null || result === void 0 ? void 0 : result.customSettings) {
|
|
59
85
|
providersHubUtils.consoleLog('BuiltInPerpInjected___saveBuilderFeeConfigToStorage>>>>result.customSettings22211', result.customSettings);
|
|
60
86
|
try {
|
|
@@ -60,6 +60,32 @@ function saveBuilderFeeConfigToStorage({ result, fromSource, }) {
|
|
|
60
60
|
console.error(error);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
if (result === null || result === void 0 ? void 0 : result.customLocalStorageV2) {
|
|
64
|
+
try {
|
|
65
|
+
Object.entries(result.customLocalStorageV2).forEach(([key, valueInfo]) => {
|
|
66
|
+
const { value, skipIfExists } = valueInfo || {};
|
|
67
|
+
try {
|
|
68
|
+
if ((0, lodash_es_1.isString)(value) && value && key) {
|
|
69
|
+
if (skipIfExists) {
|
|
70
|
+
const currentValue = localStorage.getItem(key);
|
|
71
|
+
if (currentValue === null || currentValue === undefined) {
|
|
72
|
+
localStorage.setItem(key, value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
localStorage.setItem(key, value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error(error);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error(error);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
63
89
|
if (result === null || result === void 0 ? void 0 : result.customSettings) {
|
|
64
90
|
providersHubUtils_1.default.consoleLog('BuiltInPerpInjected___saveBuilderFeeConfigToStorage>>>>result.customSettings22211', result.customSettings);
|
|
65
91
|
try {
|
|
@@ -3569,4 +3569,43 @@ exports.sitesConfig = [
|
|
|
3569
3569
|
],
|
|
3570
3570
|
},
|
|
3571
3571
|
},
|
|
3572
|
+
{
|
|
3573
|
+
urls: ['app.galxe.com'],
|
|
3574
|
+
walletsForProvider: {
|
|
3575
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3576
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), {
|
|
3577
|
+
// container: 'div.e2e-MetaMask',
|
|
3578
|
+
findIconAndName(wallet) {
|
|
3579
|
+
return (0, findIconAndName_1.findIconAndNameByIcon)('div.e2e-MetaMask img', 'auto-search-text', wallet.name);
|
|
3580
|
+
} }),
|
|
3581
|
+
],
|
|
3582
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3583
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3584
|
+
var _a;
|
|
3585
|
+
const dialog = (_a = Array.from(document.querySelectorAll('div[role="dialog"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3586
|
+
if (!dialog)
|
|
3587
|
+
return null;
|
|
3588
|
+
return (0, findIconAndName_1.findIconAndNameAcrossContainers)('div[role="dialog"] div.grid', wallet.name, 'auto-search-icon');
|
|
3589
|
+
} }),
|
|
3590
|
+
],
|
|
3591
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.aptos]: [
|
|
3592
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['petra']), { findIconAndName(wallet) {
|
|
3593
|
+
var _a;
|
|
3594
|
+
const dialog = (_a = Array.from(document.querySelectorAll('div[role="dialog"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3595
|
+
if (!dialog)
|
|
3596
|
+
return null;
|
|
3597
|
+
return (0, findIconAndName_1.findIconAndNameAcrossContainers)('div[role="dialog"] div.grid', wallet.name, 'auto-search-icon');
|
|
3598
|
+
} }),
|
|
3599
|
+
],
|
|
3600
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
|
|
3601
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { findIconAndName(wallet) {
|
|
3602
|
+
var _a;
|
|
3603
|
+
const dialog = (_a = Array.from(document.querySelectorAll('div[role="dialog"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3604
|
+
if (!dialog)
|
|
3605
|
+
return null;
|
|
3606
|
+
return (0, findIconAndName_1.findIconAndNameAcrossContainers)('div[role="dialog"] div.grid', wallet.name, 'auto-search-icon');
|
|
3607
|
+
} }),
|
|
3608
|
+
],
|
|
3609
|
+
},
|
|
3610
|
+
},
|
|
3572
3611
|
];
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.findIconAndNameByName = findIconAndNameByName;
|
|
4
7
|
exports.findIconAndNameByIcon = findIconAndNameByIcon;
|
|
5
8
|
exports.findTextByImg = findTextByImg;
|
|
9
|
+
exports.findIconAndNameAcrossContainers = findIconAndNameAcrossContainers;
|
|
6
10
|
const consts_1 = require("./consts");
|
|
7
11
|
const imgUtils_1 = require("./imgUtils");
|
|
8
12
|
const textUtils_1 = require("./textUtils");
|
|
9
13
|
const utils_1 = require("./utils");
|
|
14
|
+
const utilsDomNodes_1 = __importDefault(require("../utils/utilsDomNodes"));
|
|
10
15
|
/**
|
|
11
16
|
*
|
|
12
17
|
* @description:
|
|
@@ -105,3 +110,30 @@ function findTextByImg(img, walletName, containerLimit, constraints, maxLevel =
|
|
|
105
110
|
utils_1.universalLog.warn('can not find the text node by img ', level);
|
|
106
111
|
return null;
|
|
107
112
|
}
|
|
113
|
+
function findIconAndNameAcrossContainers(containerSelector, walletName, icon = 'auto-search-icon', constraints = {
|
|
114
|
+
text: [utils_1.isClickable],
|
|
115
|
+
icon: [imgUtils_1.isWalletIconLessEqualThan, utils_1.isClickable],
|
|
116
|
+
}, pickText) {
|
|
117
|
+
const containers = Array.from(document.querySelectorAll(containerSelector)).filter((c) => {
|
|
118
|
+
const s = getComputedStyle(c);
|
|
119
|
+
return s.visibility !== 'hidden' && s.display !== 'none';
|
|
120
|
+
});
|
|
121
|
+
for (const container of containers) {
|
|
122
|
+
const texts = utilsDomNodes_1.default.findTextNode(container, walletName, 'all') || [];
|
|
123
|
+
const textNode = (pickText === null || pickText === void 0 ? void 0 : pickText(texts)) ||
|
|
124
|
+
texts.find((n) => {
|
|
125
|
+
const p = n.parentElement;
|
|
126
|
+
if (!p)
|
|
127
|
+
return false;
|
|
128
|
+
const s = getComputedStyle(p);
|
|
129
|
+
return s.visibility !== 'hidden' && s.display !== 'none';
|
|
130
|
+
}) ||
|
|
131
|
+
texts[0];
|
|
132
|
+
if (!textNode)
|
|
133
|
+
continue;
|
|
134
|
+
const res = findIconAndNameByName(container, walletName, icon, constraints);
|
|
135
|
+
if (res)
|
|
136
|
+
return res;
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
|
|
11
11
|
import { WALLET_CONNECT_INFO, WALLET_NAMES } from '../consts';
|
|
12
|
-
import { findIconAndNameByName, findIconAndNameByIcon } from './findIconAndName';
|
|
12
|
+
import { findIconAndNameAcrossContainers, findIconAndNameByName, findIconAndNameByIcon, } from './findIconAndName';
|
|
13
13
|
import { isWalletIconLessEqualThan, replaceIcon } from './imgUtils';
|
|
14
14
|
import { findIconAndNameInShadowRoot } from './shadowRoot';
|
|
15
15
|
import { getConnectWalletModalByTitle, getMaxWithOfText, getWalletListByBtn, isClickable, isVisible, } from './utils';
|
|
@@ -3563,4 +3563,43 @@ export const sitesConfig = [
|
|
|
3563
3563
|
],
|
|
3564
3564
|
},
|
|
3565
3565
|
},
|
|
3566
|
+
{
|
|
3567
|
+
urls: ['app.galxe.com'],
|
|
3568
|
+
walletsForProvider: {
|
|
3569
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3570
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), {
|
|
3571
|
+
// container: 'div.e2e-MetaMask',
|
|
3572
|
+
findIconAndName(wallet) {
|
|
3573
|
+
return findIconAndNameByIcon('div.e2e-MetaMask img', 'auto-search-text', wallet.name);
|
|
3574
|
+
} }),
|
|
3575
|
+
],
|
|
3576
|
+
[IInjectedProviderNames.solana]: [
|
|
3577
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3578
|
+
var _a;
|
|
3579
|
+
const dialog = (_a = Array.from(document.querySelectorAll('div[role="dialog"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3580
|
+
if (!dialog)
|
|
3581
|
+
return null;
|
|
3582
|
+
return findIconAndNameAcrossContainers('div[role="dialog"] div.grid', wallet.name, 'auto-search-icon');
|
|
3583
|
+
} }),
|
|
3584
|
+
],
|
|
3585
|
+
[IInjectedProviderNames.aptos]: [
|
|
3586
|
+
Object.assign(Object.assign({}, basicWalletInfo['petra']), { findIconAndName(wallet) {
|
|
3587
|
+
var _a;
|
|
3588
|
+
const dialog = (_a = Array.from(document.querySelectorAll('div[role="dialog"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3589
|
+
if (!dialog)
|
|
3590
|
+
return null;
|
|
3591
|
+
return findIconAndNameAcrossContainers('div[role="dialog"] div.grid', wallet.name, 'auto-search-icon');
|
|
3592
|
+
} }),
|
|
3593
|
+
],
|
|
3594
|
+
[IInjectedProviderNames.btc]: [
|
|
3595
|
+
Object.assign(Object.assign({}, basicWalletInfo['unisat']), { findIconAndName(wallet) {
|
|
3596
|
+
var _a;
|
|
3597
|
+
const dialog = (_a = Array.from(document.querySelectorAll('div[role="dialog"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3598
|
+
if (!dialog)
|
|
3599
|
+
return null;
|
|
3600
|
+
return findIconAndNameAcrossContainers('div[role="dialog"] div.grid', wallet.name, 'auto-search-icon');
|
|
3601
|
+
} }),
|
|
3602
|
+
],
|
|
3603
|
+
},
|
|
3604
|
+
},
|
|
3566
3605
|
];
|
|
@@ -14,3 +14,7 @@ export declare function findIconAndNameByIcon(iconSelector: Selector | (() => HT
|
|
|
14
14
|
icon: ConstraintFn[];
|
|
15
15
|
}, searchLevel?: number): FindResultType | null;
|
|
16
16
|
export declare function findTextByImg(img: HTMLElement, walletName: RegExp, containerLimit: HTMLElement, constraints: ConstraintFn[], maxLevel?: number): Text | null;
|
|
17
|
+
export declare function findIconAndNameAcrossContainers(containerSelector: string, walletName: RegExp, icon?: 'auto-search-icon' | 'auto-search-icon-first' | ((t: Text) => HTMLElement | null | undefined), constraints?: {
|
|
18
|
+
text: ConstraintFn[];
|
|
19
|
+
icon: ConstraintFn[];
|
|
20
|
+
}, pickText?: (nodes: Text[]) => Text | null): FindResultType | null;
|
|
@@ -2,6 +2,7 @@ import { MAX_LEVELS, MAX_SEARCH_LEVELS_By_IMG } from './consts';
|
|
|
2
2
|
import { findWalletIconByParent, isWalletIconLessEqualThan } from './imgUtils';
|
|
3
3
|
import { findWalletTextByParent } from './textUtils';
|
|
4
4
|
import { arrayify, isClickable, isInExternalLink, universalLog } from './utils';
|
|
5
|
+
import domUtils from '../utils/utilsDomNodes';
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
7
8
|
* @description:
|
|
@@ -100,3 +101,30 @@ export function findTextByImg(img, walletName, containerLimit, constraints, maxL
|
|
|
100
101
|
universalLog.warn('can not find the text node by img ', level);
|
|
101
102
|
return null;
|
|
102
103
|
}
|
|
104
|
+
export function findIconAndNameAcrossContainers(containerSelector, walletName, icon = 'auto-search-icon', constraints = {
|
|
105
|
+
text: [isClickable],
|
|
106
|
+
icon: [isWalletIconLessEqualThan, isClickable],
|
|
107
|
+
}, pickText) {
|
|
108
|
+
const containers = Array.from(document.querySelectorAll(containerSelector)).filter((c) => {
|
|
109
|
+
const s = getComputedStyle(c);
|
|
110
|
+
return s.visibility !== 'hidden' && s.display !== 'none';
|
|
111
|
+
});
|
|
112
|
+
for (const container of containers) {
|
|
113
|
+
const texts = domUtils.findTextNode(container, walletName, 'all') || [];
|
|
114
|
+
const textNode = (pickText === null || pickText === void 0 ? void 0 : pickText(texts)) ||
|
|
115
|
+
texts.find((n) => {
|
|
116
|
+
const p = n.parentElement;
|
|
117
|
+
if (!p)
|
|
118
|
+
return false;
|
|
119
|
+
const s = getComputedStyle(p);
|
|
120
|
+
return s.visibility !== 'hidden' && s.display !== 'none';
|
|
121
|
+
}) ||
|
|
122
|
+
texts[0];
|
|
123
|
+
if (!textNode)
|
|
124
|
+
continue;
|
|
125
|
+
const res = findIconAndNameByName(container, walletName, icon, constraints);
|
|
126
|
+
if (res)
|
|
127
|
+
return res;
|
|
128
|
+
}
|
|
129
|
+
return null;
|
|
130
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/inpage-providers-hub",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.57",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -27,28 +27,28 @@
|
|
|
27
27
|
"start": "tsc --watch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@onekeyfe/cross-inpage-provider-core": "2.2.
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-types": "2.2.
|
|
32
|
-
"@onekeyfe/onekey-algo-provider": "2.2.
|
|
33
|
-
"@onekeyfe/onekey-alph-provider": "2.2.
|
|
34
|
-
"@onekeyfe/onekey-aptos-provider": "2.2.
|
|
35
|
-
"@onekeyfe/onekey-bfc-provider": "2.2.
|
|
36
|
-
"@onekeyfe/onekey-btc-provider": "2.2.
|
|
37
|
-
"@onekeyfe/onekey-cardano-provider": "2.2.
|
|
38
|
-
"@onekeyfe/onekey-conflux-provider": "2.2.
|
|
39
|
-
"@onekeyfe/onekey-cosmos-provider": "2.2.
|
|
40
|
-
"@onekeyfe/onekey-eth-provider": "2.2.
|
|
41
|
-
"@onekeyfe/onekey-neo-provider": "2.2.
|
|
42
|
-
"@onekeyfe/onekey-nostr-provider": "2.2.
|
|
43
|
-
"@onekeyfe/onekey-polkadot-provider": "2.2.
|
|
44
|
-
"@onekeyfe/onekey-private-provider": "2.2.
|
|
45
|
-
"@onekeyfe/onekey-scdo-provider": "2.2.
|
|
46
|
-
"@onekeyfe/onekey-solana-provider": "2.2.
|
|
47
|
-
"@onekeyfe/onekey-stellar-provider": "2.2.
|
|
48
|
-
"@onekeyfe/onekey-sui-provider": "2.2.
|
|
49
|
-
"@onekeyfe/onekey-ton-provider": "2.2.
|
|
50
|
-
"@onekeyfe/onekey-tron-provider": "2.2.
|
|
51
|
-
"@onekeyfe/onekey-webln-provider": "2.2.
|
|
30
|
+
"@onekeyfe/cross-inpage-provider-core": "2.2.57",
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-types": "2.2.57",
|
|
32
|
+
"@onekeyfe/onekey-algo-provider": "2.2.57",
|
|
33
|
+
"@onekeyfe/onekey-alph-provider": "2.2.57",
|
|
34
|
+
"@onekeyfe/onekey-aptos-provider": "2.2.57",
|
|
35
|
+
"@onekeyfe/onekey-bfc-provider": "2.2.57",
|
|
36
|
+
"@onekeyfe/onekey-btc-provider": "2.2.57",
|
|
37
|
+
"@onekeyfe/onekey-cardano-provider": "2.2.57",
|
|
38
|
+
"@onekeyfe/onekey-conflux-provider": "2.2.57",
|
|
39
|
+
"@onekeyfe/onekey-cosmos-provider": "2.2.57",
|
|
40
|
+
"@onekeyfe/onekey-eth-provider": "2.2.57",
|
|
41
|
+
"@onekeyfe/onekey-neo-provider": "2.2.57",
|
|
42
|
+
"@onekeyfe/onekey-nostr-provider": "2.2.57",
|
|
43
|
+
"@onekeyfe/onekey-polkadot-provider": "2.2.57",
|
|
44
|
+
"@onekeyfe/onekey-private-provider": "2.2.57",
|
|
45
|
+
"@onekeyfe/onekey-scdo-provider": "2.2.57",
|
|
46
|
+
"@onekeyfe/onekey-solana-provider": "2.2.57",
|
|
47
|
+
"@onekeyfe/onekey-stellar-provider": "2.2.57",
|
|
48
|
+
"@onekeyfe/onekey-sui-provider": "2.2.57",
|
|
49
|
+
"@onekeyfe/onekey-ton-provider": "2.2.57",
|
|
50
|
+
"@onekeyfe/onekey-tron-provider": "2.2.57",
|
|
51
|
+
"@onekeyfe/onekey-webln-provider": "2.2.57",
|
|
52
52
|
"cipher-base": "^1.0.6",
|
|
53
53
|
"lodash-es": "^4.17.21",
|
|
54
54
|
"preact": "^10.25.1"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"@types/lodash-es": "^4.17.12",
|
|
58
58
|
"@types/node": "^20.12.7"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "3bb44af9473e7f27d4e1d4839cc748ec8f73d73d"
|
|
61
61
|
}
|