@onekeyfe/inpage-providers-hub 2.0.3 → 2.0.4
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/universal/config.js +82 -23
- package/dist/cjs/connectButtonHack/universal/index.js +2 -2
- package/dist/cjs/connectButtonHack/universal/utils.js +2 -1
- package/dist/cjs/injectWeb3Provider.js +3 -1
- package/dist/connectButtonHack/universal/config.d.ts +1 -1
- package/dist/connectButtonHack/universal/config.js +82 -23
- package/dist/connectButtonHack/universal/index.js +2 -2
- package/dist/connectButtonHack/universal/utils.d.ts +1 -1
- package/dist/connectButtonHack/universal/utils.js +2 -1
- package/dist/injectWeb3Provider.js +3 -1
- package/package.json +19 -19
|
@@ -588,18 +588,27 @@ exports.sitesConfig = [
|
|
|
588
588
|
walletsForProvider: {
|
|
589
589
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
590
590
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
591
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.chakra-modal__content-container',
|
|
591
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.chakra-modal__content-container', [
|
|
592
|
+
'Connect Wallet',
|
|
593
|
+
'链接钱包',
|
|
594
|
+
]);
|
|
592
595
|
return (modal &&
|
|
593
596
|
(0, findIconAndName_1.findIconAndNameByIcon)('img[alt="MetaMask"]', (icon) => { var _a; return (_a = icon.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement; }, name, modal));
|
|
594
597
|
} }),
|
|
595
598
|
Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
596
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.chakra-modal__content-container',
|
|
599
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.chakra-modal__content-container', [
|
|
600
|
+
'Connect Wallet',
|
|
601
|
+
'链接钱包',
|
|
602
|
+
]);
|
|
597
603
|
return (modal &&
|
|
598
604
|
(0, findIconAndName_1.findIconAndNameByIcon)('img[alt="WalletConnect"]', (icon) => { var _a; return (_a = icon.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement; }, name, modal));
|
|
599
605
|
} }),
|
|
600
606
|
],
|
|
601
607
|
[cross_inpage_provider_types_1.IInjectedProviderNames.polkadot]: [
|
|
602
|
-
Object.assign(Object.assign({}, exports.basicWalletInfo['polkadot']), { name: /^polkadot\.js$/i, container: () => (0, utils_1.getConnectWalletModalByTitle)('div.chakra-modal__content-container',
|
|
608
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['polkadot']), { name: /^polkadot\.js$/i, container: () => (0, utils_1.getConnectWalletModalByTitle)('div.chakra-modal__content-container', [
|
|
609
|
+
'Connect Wallet',
|
|
610
|
+
'链接钱包',
|
|
611
|
+
]) }),
|
|
603
612
|
],
|
|
604
613
|
},
|
|
605
614
|
},
|
|
@@ -838,15 +847,8 @@ exports.sitesConfig = [
|
|
|
838
847
|
urls: ['dapp.moneyonchain.com'],
|
|
839
848
|
walletsForProvider: {
|
|
840
849
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
841
|
-
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), {
|
|
842
|
-
|
|
843
|
-
return (modal && (0, findIconAndName_1.findIconAndNameByIcon)('img[alt="MetaMask"]', 'auto-search-text', name, modal));
|
|
844
|
-
} }),
|
|
845
|
-
Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
846
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('#rlogin-connect-modal', 'Connect your wallet');
|
|
847
|
-
return (modal &&
|
|
848
|
-
(0, findIconAndName_1.findIconAndNameByIcon)('img[alt="WalletConnect"]', 'auto-search-text', name, modal));
|
|
849
|
-
} }),
|
|
850
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: '#rlogin-connect-modal' }),
|
|
851
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: '#rlogin-connect-modal' }),
|
|
850
852
|
],
|
|
851
853
|
},
|
|
852
854
|
},
|
|
@@ -1142,8 +1144,11 @@ exports.sitesConfig = [
|
|
|
1142
1144
|
const modal = document.querySelector('#wallet-info-dropdown ul');
|
|
1143
1145
|
const textNode = (0, textUtils_1.findWalletTextByParent)(modal, name, [utils_1.isClickable]);
|
|
1144
1146
|
const newTextNode = textNode && (0, textUtils_1.replaceText)(textNode, updatedName);
|
|
1145
|
-
(newTextNode
|
|
1146
|
-
|
|
1147
|
+
if (!newTextNode) {
|
|
1148
|
+
return null;
|
|
1149
|
+
}
|
|
1150
|
+
newTextNode.parentElement && (0, textUtils_1.makeTextEllipse)(newTextNode.parentElement);
|
|
1151
|
+
return newTextNode.parentElement;
|
|
1147
1152
|
} }),
|
|
1148
1153
|
],
|
|
1149
1154
|
},
|
|
@@ -1210,7 +1215,7 @@ exports.sitesConfig = [
|
|
|
1210
1215
|
const text = button && (0, textUtils_1.findWalletTextByParent)(button, name, []);
|
|
1211
1216
|
text && (0, textUtils_1.replaceText)(text, updatedName);
|
|
1212
1217
|
button && (button.style.backgroundImage = `url(${updatedIcon})`);
|
|
1213
|
-
return
|
|
1218
|
+
return button;
|
|
1214
1219
|
} }),
|
|
1215
1220
|
],
|
|
1216
1221
|
},
|
|
@@ -1315,7 +1320,7 @@ exports.sitesConfig = [
|
|
|
1315
1320
|
},
|
|
1316
1321
|
},
|
|
1317
1322
|
{
|
|
1318
|
-
urls: ['pancakeswap.finance', 'www.pancakeswap.finance'],
|
|
1323
|
+
urls: ['pancakeswap.finance', 'www.pancakeswap.finance', 'aptos.pancakeswap.finance'],
|
|
1319
1324
|
skip: {
|
|
1320
1325
|
mobile: true, //temp skip for lack walletconnect
|
|
1321
1326
|
},
|
|
@@ -1332,6 +1337,18 @@ exports.sitesConfig = [
|
|
|
1332
1337
|
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="wallets/walletconnect.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
|
|
1333
1338
|
} }),
|
|
1334
1339
|
],
|
|
1340
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.aptos]: [
|
|
1341
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['petra']), { findIconAndName({ name }) {
|
|
1342
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('#portal-root', 'Connect Wallet');
|
|
1343
|
+
return (modal &&
|
|
1344
|
+
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="wallets/petra.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
|
|
1345
|
+
} }),
|
|
1346
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['martian']), { findIconAndName({ name }) {
|
|
1347
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('#portal-root', 'Connect Wallet');
|
|
1348
|
+
return (modal &&
|
|
1349
|
+
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="wallets/martian.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
|
|
1350
|
+
} }),
|
|
1351
|
+
],
|
|
1335
1352
|
},
|
|
1336
1353
|
},
|
|
1337
1354
|
{
|
|
@@ -1525,7 +1542,10 @@ exports.sitesConfig = [
|
|
|
1525
1542
|
walletsForProvider: {
|
|
1526
1543
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1527
1544
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
1528
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]',
|
|
1545
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', [
|
|
1546
|
+
'Connect Wallet',
|
|
1547
|
+
'连接钱包',
|
|
1548
|
+
]);
|
|
1529
1549
|
return (modal &&
|
|
1530
1550
|
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="metamask.svg"][alt="Metamask"]', 'auto-search-text', name, modal));
|
|
1531
1551
|
},
|
|
@@ -1535,7 +1555,10 @@ exports.sitesConfig = [
|
|
|
1535
1555
|
],
|
|
1536
1556
|
[cross_inpage_provider_types_1.IInjectedProviderNames.cosmos]: [
|
|
1537
1557
|
Object.assign(Object.assign({}, exports.basicWalletInfo['keplr']), { findIconAndName({ name }) {
|
|
1538
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]',
|
|
1558
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', [
|
|
1559
|
+
'Connect Wallet',
|
|
1560
|
+
'连接钱包',
|
|
1561
|
+
]);
|
|
1539
1562
|
return (modal &&
|
|
1540
1563
|
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="keplr.svg"][alt="Keplr"]', 'auto-search-text', name, modal));
|
|
1541
1564
|
},
|
|
@@ -1613,12 +1636,18 @@ exports.sitesConfig = [
|
|
|
1613
1636
|
walletsForProvider: {
|
|
1614
1637
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1615
1638
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
1616
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.connect-options',
|
|
1639
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.connect-options', [
|
|
1640
|
+
'Select Wallet',
|
|
1641
|
+
'选择钱包',
|
|
1642
|
+
]);
|
|
1617
1643
|
return (modal &&
|
|
1618
1644
|
(0, findIconAndName_1.findIconAndNameByIcon)('img.logo[alt="MetaMask"]', 'auto-search-text', name, modal));
|
|
1619
1645
|
} }),
|
|
1620
1646
|
Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
1621
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.connect-options',
|
|
1647
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.connect-options', [
|
|
1648
|
+
'Select Wallet',
|
|
1649
|
+
'选择钱包',
|
|
1650
|
+
]);
|
|
1622
1651
|
return (modal &&
|
|
1623
1652
|
(0, findIconAndName_1.findIconAndNameByIcon)('img.logo[alt="WalletConnect"]', 'auto-search-text', name, modal));
|
|
1624
1653
|
} }),
|
|
@@ -1760,7 +1789,7 @@ exports.sitesConfig = [
|
|
|
1760
1789
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1761
1790
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
1762
1791
|
var _a, _b;
|
|
1763
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', 'CONNECT A WALLET');
|
|
1792
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', ['CONNECT A WALLET', '连接钱包', 'ウォレットを接続']);
|
|
1764
1793
|
if (!modal) {
|
|
1765
1794
|
return null;
|
|
1766
1795
|
}
|
|
@@ -1780,7 +1809,7 @@ exports.sitesConfig = [
|
|
|
1780
1809
|
} }),
|
|
1781
1810
|
Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
1782
1811
|
var _a, _b;
|
|
1783
|
-
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', 'CONNECT A WALLET');
|
|
1812
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', ['CONNECT A WALLET', '连接钱包', 'ウォレットを接続']);
|
|
1784
1813
|
if (!modal) {
|
|
1785
1814
|
return null;
|
|
1786
1815
|
}
|
|
@@ -2065,6 +2094,13 @@ exports.sitesConfig = [
|
|
|
2065
2094
|
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="static/media/metamask"]', 'auto-search-text', name, modal));
|
|
2066
2095
|
} }),
|
|
2067
2096
|
],
|
|
2097
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.tron]: [
|
|
2098
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['tronlink']), { findIconAndName({ name }) {
|
|
2099
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.ant-modal-content', 'Connect Wallet');
|
|
2100
|
+
return (modal &&
|
|
2101
|
+
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="static/media/tronlink"]', 'auto-search-text', name, modal));
|
|
2102
|
+
} }),
|
|
2103
|
+
],
|
|
2068
2104
|
},
|
|
2069
2105
|
},
|
|
2070
2106
|
{
|
|
@@ -2481,7 +2517,10 @@ exports.sitesConfig = [
|
|
|
2481
2517
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { name: /^Metamask$/, findIconAndName({ name }) {
|
|
2482
2518
|
const modal = (0, utils_1.getConnectWalletModalByTitle)('#portal-root div[role="dialog"]', 'Connect Wallet');
|
|
2483
2519
|
return (modal &&
|
|
2484
|
-
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="metamask"]', 'auto-search-text', name, modal
|
|
2520
|
+
(0, findIconAndName_1.findIconAndNameByIcon)('img[src*="metamask"]', 'auto-search-text', name, modal, {
|
|
2521
|
+
'icon': [imgUtils_1.isWalletIconLessEqualThan],
|
|
2522
|
+
'text': [],
|
|
2523
|
+
}, 5));
|
|
2485
2524
|
} }),
|
|
2486
2525
|
],
|
|
2487
2526
|
},
|
|
@@ -2567,4 +2606,24 @@ exports.sitesConfig = [
|
|
|
2567
2606
|
],
|
|
2568
2607
|
},
|
|
2569
2608
|
},
|
|
2609
|
+
{
|
|
2610
|
+
urls: ['www.erisprotocol.com'],
|
|
2611
|
+
testUrls: ['www.erisprotocol.com/terra/amp-compounder'],
|
|
2612
|
+
walletsForProvider: {
|
|
2613
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.cosmos]: [
|
|
2614
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['keplr']), { name: /^Keplr$/, update({ name, updatedName }) {
|
|
2615
|
+
var _a;
|
|
2616
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('tui-dialog', 'Connected Wallets');
|
|
2617
|
+
if (!modal) {
|
|
2618
|
+
return null;
|
|
2619
|
+
}
|
|
2620
|
+
const text = (0, textUtils_1.findWalletTextByParent)(modal, name, []);
|
|
2621
|
+
if (!text) {
|
|
2622
|
+
return null;
|
|
2623
|
+
}
|
|
2624
|
+
return (_a = (0, textUtils_1.replaceText)(text, updatedName)) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
2625
|
+
} }),
|
|
2626
|
+
],
|
|
2627
|
+
},
|
|
2628
|
+
},
|
|
2570
2629
|
];
|
|
@@ -33,8 +33,8 @@ function hackWalletConnectButton(sites) {
|
|
|
33
33
|
utils_1.universalLog.log(`[replaceMethod] ${urls[0]} begin to run for ${walletId.walletId}`);
|
|
34
34
|
let result = null;
|
|
35
35
|
if (update) {
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const ele = update(wallet);
|
|
37
|
+
ele && walletId.updateFlag(ele);
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
else if (findIconAndName) {
|
|
@@ -23,9 +23,10 @@ const getConnectWalletModalByTitle = (modalSelector, title, filter) => {
|
|
|
23
23
|
for (const selector of selectors) {
|
|
24
24
|
eles.push(...Array.from(document.querySelectorAll(selector)));
|
|
25
25
|
}
|
|
26
|
+
const titles = arrayify(title);
|
|
26
27
|
const res = [];
|
|
27
28
|
for (const ele of eles) {
|
|
28
|
-
if (isVisible(ele) && filter ? filter(ele) : true && ele.innerText.includes(
|
|
29
|
+
if (isVisible(ele) && filter ? filter(ele) : true && titles.some((t) => ele.innerText.includes(t))) {
|
|
29
30
|
res.push(ele);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -117,7 +117,9 @@ function injectWeb3Provider() {
|
|
|
117
117
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('tronLink', tron);
|
|
118
118
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('suiWallet', sui);
|
|
119
119
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('unisat', btc);
|
|
120
|
-
(0, cross_inpage_provider_core_1.defineWindowProperty)('btcwallet', btcWallet
|
|
120
|
+
(0, cross_inpage_provider_core_1.defineWindowProperty)('btcwallet', btcWallet, {
|
|
121
|
+
disablePlatform: ['extension', 'desktop'],
|
|
122
|
+
});
|
|
121
123
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('algorand', algorand);
|
|
122
124
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('exodus', {
|
|
123
125
|
algorand,
|
|
@@ -119,7 +119,7 @@ export type WalletInfo = {
|
|
|
119
119
|
/**
|
|
120
120
|
* used when there is only one icon or name element(not both) and other special cases
|
|
121
121
|
*/
|
|
122
|
-
update?: (this: void, wallet: WalletInfo) =>
|
|
122
|
+
update?: (this: void, wallet: WalletInfo) => HTMLElement | null;
|
|
123
123
|
/**
|
|
124
124
|
* skip testing
|
|
125
125
|
*/
|
|
@@ -582,18 +582,27 @@ export const sitesConfig = [
|
|
|
582
582
|
walletsForProvider: {
|
|
583
583
|
[IInjectedProviderNames.ethereum]: [
|
|
584
584
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
585
|
-
const modal = getConnectWalletModalByTitle('div.chakra-modal__content-container',
|
|
585
|
+
const modal = getConnectWalletModalByTitle('div.chakra-modal__content-container', [
|
|
586
|
+
'Connect Wallet',
|
|
587
|
+
'链接钱包',
|
|
588
|
+
]);
|
|
586
589
|
return (modal &&
|
|
587
590
|
findIconAndNameByIcon('img[alt="MetaMask"]', (icon) => { var _a; return (_a = icon.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement; }, name, modal));
|
|
588
591
|
} }),
|
|
589
592
|
Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
590
|
-
const modal = getConnectWalletModalByTitle('div.chakra-modal__content-container',
|
|
593
|
+
const modal = getConnectWalletModalByTitle('div.chakra-modal__content-container', [
|
|
594
|
+
'Connect Wallet',
|
|
595
|
+
'链接钱包',
|
|
596
|
+
]);
|
|
591
597
|
return (modal &&
|
|
592
598
|
findIconAndNameByIcon('img[alt="WalletConnect"]', (icon) => { var _a; return (_a = icon.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement; }, name, modal));
|
|
593
599
|
} }),
|
|
594
600
|
],
|
|
595
601
|
[IInjectedProviderNames.polkadot]: [
|
|
596
|
-
Object.assign(Object.assign({}, basicWalletInfo['polkadot']), { name: /^polkadot\.js$/i, container: () => getConnectWalletModalByTitle('div.chakra-modal__content-container',
|
|
602
|
+
Object.assign(Object.assign({}, basicWalletInfo['polkadot']), { name: /^polkadot\.js$/i, container: () => getConnectWalletModalByTitle('div.chakra-modal__content-container', [
|
|
603
|
+
'Connect Wallet',
|
|
604
|
+
'链接钱包',
|
|
605
|
+
]) }),
|
|
597
606
|
],
|
|
598
607
|
},
|
|
599
608
|
},
|
|
@@ -832,15 +841,8 @@ export const sitesConfig = [
|
|
|
832
841
|
urls: ['dapp.moneyonchain.com'],
|
|
833
842
|
walletsForProvider: {
|
|
834
843
|
[IInjectedProviderNames.ethereum]: [
|
|
835
|
-
Object.assign(Object.assign({}, basicWalletInfo['metamask']), {
|
|
836
|
-
|
|
837
|
-
return (modal && findIconAndNameByIcon('img[alt="MetaMask"]', 'auto-search-text', name, modal));
|
|
838
|
-
} }),
|
|
839
|
-
Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
840
|
-
const modal = getConnectWalletModalByTitle('#rlogin-connect-modal', 'Connect your wallet');
|
|
841
|
-
return (modal &&
|
|
842
|
-
findIconAndNameByIcon('img[alt="WalletConnect"]', 'auto-search-text', name, modal));
|
|
843
|
-
} }),
|
|
844
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: '#rlogin-connect-modal' }),
|
|
845
|
+
Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { container: '#rlogin-connect-modal' }),
|
|
844
846
|
],
|
|
845
847
|
},
|
|
846
848
|
},
|
|
@@ -1136,8 +1138,11 @@ export const sitesConfig = [
|
|
|
1136
1138
|
const modal = document.querySelector('#wallet-info-dropdown ul');
|
|
1137
1139
|
const textNode = findWalletTextByParent(modal, name, [isClickable]);
|
|
1138
1140
|
const newTextNode = textNode && replaceText(textNode, updatedName);
|
|
1139
|
-
(newTextNode
|
|
1140
|
-
|
|
1141
|
+
if (!newTextNode) {
|
|
1142
|
+
return null;
|
|
1143
|
+
}
|
|
1144
|
+
newTextNode.parentElement && makeTextEllipse(newTextNode.parentElement);
|
|
1145
|
+
return newTextNode.parentElement;
|
|
1141
1146
|
} }),
|
|
1142
1147
|
],
|
|
1143
1148
|
},
|
|
@@ -1204,7 +1209,7 @@ export const sitesConfig = [
|
|
|
1204
1209
|
const text = button && findWalletTextByParent(button, name, []);
|
|
1205
1210
|
text && replaceText(text, updatedName);
|
|
1206
1211
|
button && (button.style.backgroundImage = `url(${updatedIcon})`);
|
|
1207
|
-
return
|
|
1212
|
+
return button;
|
|
1208
1213
|
} }),
|
|
1209
1214
|
],
|
|
1210
1215
|
},
|
|
@@ -1309,7 +1314,7 @@ export const sitesConfig = [
|
|
|
1309
1314
|
},
|
|
1310
1315
|
},
|
|
1311
1316
|
{
|
|
1312
|
-
urls: ['pancakeswap.finance', 'www.pancakeswap.finance'],
|
|
1317
|
+
urls: ['pancakeswap.finance', 'www.pancakeswap.finance', 'aptos.pancakeswap.finance'],
|
|
1313
1318
|
skip: {
|
|
1314
1319
|
mobile: true, //temp skip for lack walletconnect
|
|
1315
1320
|
},
|
|
@@ -1326,6 +1331,18 @@ export const sitesConfig = [
|
|
|
1326
1331
|
findIconAndNameByIcon('img[src*="wallets/walletconnect.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
|
|
1327
1332
|
} }),
|
|
1328
1333
|
],
|
|
1334
|
+
[IInjectedProviderNames.aptos]: [
|
|
1335
|
+
Object.assign(Object.assign({}, basicWalletInfo['petra']), { findIconAndName({ name }) {
|
|
1336
|
+
const modal = getConnectWalletModalByTitle('#portal-root', 'Connect Wallet');
|
|
1337
|
+
return (modal &&
|
|
1338
|
+
findIconAndNameByIcon('img[src*="wallets/petra.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
|
|
1339
|
+
} }),
|
|
1340
|
+
Object.assign(Object.assign({}, basicWalletInfo['martian']), { findIconAndName({ name }) {
|
|
1341
|
+
const modal = getConnectWalletModalByTitle('#portal-root', 'Connect Wallet');
|
|
1342
|
+
return (modal &&
|
|
1343
|
+
findIconAndNameByIcon('img[src*="wallets/martian.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
|
|
1344
|
+
} }),
|
|
1345
|
+
],
|
|
1329
1346
|
},
|
|
1330
1347
|
},
|
|
1331
1348
|
{
|
|
@@ -1519,7 +1536,10 @@ export const sitesConfig = [
|
|
|
1519
1536
|
walletsForProvider: {
|
|
1520
1537
|
[IInjectedProviderNames.ethereum]: [
|
|
1521
1538
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
1522
|
-
const modal = getConnectWalletModalByTitle('div[role="dialog"]',
|
|
1539
|
+
const modal = getConnectWalletModalByTitle('div[role="dialog"]', [
|
|
1540
|
+
'Connect Wallet',
|
|
1541
|
+
'连接钱包',
|
|
1542
|
+
]);
|
|
1523
1543
|
return (modal &&
|
|
1524
1544
|
findIconAndNameByIcon('img[src*="metamask.svg"][alt="Metamask"]', 'auto-search-text', name, modal));
|
|
1525
1545
|
},
|
|
@@ -1529,7 +1549,10 @@ export const sitesConfig = [
|
|
|
1529
1549
|
],
|
|
1530
1550
|
[IInjectedProviderNames.cosmos]: [
|
|
1531
1551
|
Object.assign(Object.assign({}, basicWalletInfo['keplr']), { findIconAndName({ name }) {
|
|
1532
|
-
const modal = getConnectWalletModalByTitle('div[role="dialog"]',
|
|
1552
|
+
const modal = getConnectWalletModalByTitle('div[role="dialog"]', [
|
|
1553
|
+
'Connect Wallet',
|
|
1554
|
+
'连接钱包',
|
|
1555
|
+
]);
|
|
1533
1556
|
return (modal &&
|
|
1534
1557
|
findIconAndNameByIcon('img[src*="keplr.svg"][alt="Keplr"]', 'auto-search-text', name, modal));
|
|
1535
1558
|
},
|
|
@@ -1607,12 +1630,18 @@ export const sitesConfig = [
|
|
|
1607
1630
|
walletsForProvider: {
|
|
1608
1631
|
[IInjectedProviderNames.ethereum]: [
|
|
1609
1632
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
1610
|
-
const modal = getConnectWalletModalByTitle('div.connect-options',
|
|
1633
|
+
const modal = getConnectWalletModalByTitle('div.connect-options', [
|
|
1634
|
+
'Select Wallet',
|
|
1635
|
+
'选择钱包',
|
|
1636
|
+
]);
|
|
1611
1637
|
return (modal &&
|
|
1612
1638
|
findIconAndNameByIcon('img.logo[alt="MetaMask"]', 'auto-search-text', name, modal));
|
|
1613
1639
|
} }),
|
|
1614
1640
|
Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
1615
|
-
const modal = getConnectWalletModalByTitle('div.connect-options',
|
|
1641
|
+
const modal = getConnectWalletModalByTitle('div.connect-options', [
|
|
1642
|
+
'Select Wallet',
|
|
1643
|
+
'选择钱包',
|
|
1644
|
+
]);
|
|
1616
1645
|
return (modal &&
|
|
1617
1646
|
findIconAndNameByIcon('img.logo[alt="WalletConnect"]', 'auto-search-text', name, modal));
|
|
1618
1647
|
} }),
|
|
@@ -1754,7 +1783,7 @@ export const sitesConfig = [
|
|
|
1754
1783
|
[IInjectedProviderNames.ethereum]: [
|
|
1755
1784
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
1756
1785
|
var _a, _b;
|
|
1757
|
-
const modal = getConnectWalletModalByTitle('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', 'CONNECT A WALLET');
|
|
1786
|
+
const modal = getConnectWalletModalByTitle('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', ['CONNECT A WALLET', '连接钱包', 'ウォレットを接続']);
|
|
1758
1787
|
if (!modal) {
|
|
1759
1788
|
return null;
|
|
1760
1789
|
}
|
|
@@ -1774,7 +1803,7 @@ export const sitesConfig = [
|
|
|
1774
1803
|
} }),
|
|
1775
1804
|
Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
|
|
1776
1805
|
var _a, _b;
|
|
1777
|
-
const modal = getConnectWalletModalByTitle('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', 'CONNECT A WALLET');
|
|
1806
|
+
const modal = getConnectWalletModalByTitle('div.MuiDrawer-paper.MuiDrawer-paperAnchorRight', ['CONNECT A WALLET', '连接钱包', 'ウォレットを接続']);
|
|
1778
1807
|
if (!modal) {
|
|
1779
1808
|
return null;
|
|
1780
1809
|
}
|
|
@@ -2059,6 +2088,13 @@ export const sitesConfig = [
|
|
|
2059
2088
|
findIconAndNameByIcon('img[src*="static/media/metamask"]', 'auto-search-text', name, modal));
|
|
2060
2089
|
} }),
|
|
2061
2090
|
],
|
|
2091
|
+
[IInjectedProviderNames.tron]: [
|
|
2092
|
+
Object.assign(Object.assign({}, basicWalletInfo['tronlink']), { findIconAndName({ name }) {
|
|
2093
|
+
const modal = getConnectWalletModalByTitle('div.ant-modal-content', 'Connect Wallet');
|
|
2094
|
+
return (modal &&
|
|
2095
|
+
findIconAndNameByIcon('img[src*="static/media/tronlink"]', 'auto-search-text', name, modal));
|
|
2096
|
+
} }),
|
|
2097
|
+
],
|
|
2062
2098
|
},
|
|
2063
2099
|
},
|
|
2064
2100
|
{
|
|
@@ -2475,7 +2511,10 @@ export const sitesConfig = [
|
|
|
2475
2511
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { name: /^Metamask$/, findIconAndName({ name }) {
|
|
2476
2512
|
const modal = getConnectWalletModalByTitle('#portal-root div[role="dialog"]', 'Connect Wallet');
|
|
2477
2513
|
return (modal &&
|
|
2478
|
-
findIconAndNameByIcon('img[src*="metamask"]', 'auto-search-text', name, modal
|
|
2514
|
+
findIconAndNameByIcon('img[src*="metamask"]', 'auto-search-text', name, modal, {
|
|
2515
|
+
'icon': [isWalletIconLessEqualThan],
|
|
2516
|
+
'text': [],
|
|
2517
|
+
}, 5));
|
|
2479
2518
|
} }),
|
|
2480
2519
|
],
|
|
2481
2520
|
},
|
|
@@ -2561,4 +2600,24 @@ export const sitesConfig = [
|
|
|
2561
2600
|
],
|
|
2562
2601
|
},
|
|
2563
2602
|
},
|
|
2603
|
+
{
|
|
2604
|
+
urls: ['www.erisprotocol.com'],
|
|
2605
|
+
testUrls: ['www.erisprotocol.com/terra/amp-compounder'],
|
|
2606
|
+
walletsForProvider: {
|
|
2607
|
+
[IInjectedProviderNames.cosmos]: [
|
|
2608
|
+
Object.assign(Object.assign({}, basicWalletInfo['keplr']), { name: /^Keplr$/, update({ name, updatedName }) {
|
|
2609
|
+
var _a;
|
|
2610
|
+
const modal = getConnectWalletModalByTitle('tui-dialog', 'Connected Wallets');
|
|
2611
|
+
if (!modal) {
|
|
2612
|
+
return null;
|
|
2613
|
+
}
|
|
2614
|
+
const text = findWalletTextByParent(modal, name, []);
|
|
2615
|
+
if (!text) {
|
|
2616
|
+
return null;
|
|
2617
|
+
}
|
|
2618
|
+
return (_a = replaceText(text, updatedName)) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
2619
|
+
} }),
|
|
2620
|
+
],
|
|
2621
|
+
},
|
|
2622
|
+
},
|
|
2564
2623
|
];
|
|
@@ -31,8 +31,8 @@ function hackWalletConnectButton(sites) {
|
|
|
31
31
|
universalLog.log(`[replaceMethod] ${urls[0]} begin to run for ${walletId.walletId}`);
|
|
32
32
|
let result = null;
|
|
33
33
|
if (update) {
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const ele = update(wallet);
|
|
35
|
+
ele && walletId.updateFlag(ele);
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
38
|
else if (findIconAndName) {
|
|
@@ -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, filter?: ((modal: HTMLElement) => boolean) | undefined) => HTMLElement | null;
|
|
7
|
+
export declare const getConnectWalletModalByTitle: (modalSelector: Selector | Selector[], title: string | string[], filter?: ((modal: HTMLElement) => boolean) | undefined) => 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): {
|
|
@@ -18,9 +18,10 @@ export const getConnectWalletModalByTitle = (modalSelector, title, filter) => {
|
|
|
18
18
|
for (const selector of selectors) {
|
|
19
19
|
eles.push(...Array.from(document.querySelectorAll(selector)));
|
|
20
20
|
}
|
|
21
|
+
const titles = arrayify(title);
|
|
21
22
|
const res = [];
|
|
22
23
|
for (const ele of eles) {
|
|
23
|
-
if (isVisible(ele) && filter ? filter(ele) : true && ele.innerText.includes(
|
|
24
|
+
if (isVisible(ele) && filter ? filter(ele) : true && titles.some((t) => ele.innerText.includes(t))) {
|
|
24
25
|
res.push(ele);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -114,7 +114,9 @@ function injectWeb3Provider() {
|
|
|
114
114
|
defineWindowProperty('tronLink', tron);
|
|
115
115
|
defineWindowProperty('suiWallet', sui);
|
|
116
116
|
defineWindowProperty('unisat', btc);
|
|
117
|
-
defineWindowProperty('btcwallet', btcWallet
|
|
117
|
+
defineWindowProperty('btcwallet', btcWallet, {
|
|
118
|
+
disablePlatform: ['extension', 'desktop'],
|
|
119
|
+
});
|
|
118
120
|
defineWindowProperty('algorand', algorand);
|
|
119
121
|
defineWindowProperty('exodus', {
|
|
120
122
|
algorand,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/inpage-providers-hub",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
"start": "tsc --watch"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-core": "2.0.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "2.0.
|
|
35
|
-
"@onekeyfe/onekey-algo-provider": "2.0.
|
|
36
|
-
"@onekeyfe/onekey-aptos-provider": "2.0.
|
|
37
|
-
"@onekeyfe/onekey-btc-provider": "2.0.
|
|
38
|
-
"@onekeyfe/onekey-cardano-provider": "2.0.
|
|
39
|
-
"@onekeyfe/onekey-conflux-provider": "2.0.
|
|
40
|
-
"@onekeyfe/onekey-cosmos-provider": "2.0.
|
|
41
|
-
"@onekeyfe/onekey-eth-provider": "2.0.
|
|
42
|
-
"@onekeyfe/onekey-nostr-provider": "2.0.
|
|
43
|
-
"@onekeyfe/onekey-polkadot-provider": "2.0.
|
|
44
|
-
"@onekeyfe/onekey-private-external-account-provider": "2.0.
|
|
45
|
-
"@onekeyfe/onekey-private-provider": "2.0.
|
|
46
|
-
"@onekeyfe/onekey-solana-provider": "2.0.
|
|
47
|
-
"@onekeyfe/onekey-sui-provider": "2.0.
|
|
48
|
-
"@onekeyfe/onekey-tron-provider": "2.0.
|
|
49
|
-
"@onekeyfe/onekey-webln-provider": "2.0.
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-core": "2.0.4",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "2.0.4",
|
|
35
|
+
"@onekeyfe/onekey-algo-provider": "2.0.4",
|
|
36
|
+
"@onekeyfe/onekey-aptos-provider": "2.0.4",
|
|
37
|
+
"@onekeyfe/onekey-btc-provider": "2.0.4",
|
|
38
|
+
"@onekeyfe/onekey-cardano-provider": "2.0.4",
|
|
39
|
+
"@onekeyfe/onekey-conflux-provider": "2.0.4",
|
|
40
|
+
"@onekeyfe/onekey-cosmos-provider": "2.0.4",
|
|
41
|
+
"@onekeyfe/onekey-eth-provider": "2.0.4",
|
|
42
|
+
"@onekeyfe/onekey-nostr-provider": "2.0.4",
|
|
43
|
+
"@onekeyfe/onekey-polkadot-provider": "2.0.4",
|
|
44
|
+
"@onekeyfe/onekey-private-external-account-provider": "2.0.4",
|
|
45
|
+
"@onekeyfe/onekey-private-provider": "2.0.4",
|
|
46
|
+
"@onekeyfe/onekey-solana-provider": "2.0.4",
|
|
47
|
+
"@onekeyfe/onekey-sui-provider": "2.0.4",
|
|
48
|
+
"@onekeyfe/onekey-tron-provider": "2.0.4",
|
|
49
|
+
"@onekeyfe/onekey-webln-provider": "2.0.4",
|
|
50
50
|
"web3": "^1.7.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"@types/node": "^20.12.7",
|
|
55
55
|
"playwright": "^1.43.1"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "7f33acd16a25d7b1aa4d9a439d7474622630f2fc"
|
|
58
58
|
}
|