@onekeyfe/inpage-providers-hub 2.0.0-alpha.4 → 2.0.0-alpha.6

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.
Files changed (41) hide show
  1. package/LICENSE.md +51 -0
  2. package/dist/cjs/connectButtonHack/index.js +0 -4
  3. package/dist/cjs/connectButtonHack/universal/config.js +454 -5
  4. package/dist/cjs/connectButtonHack/universal/consts.js +2 -1
  5. package/dist/cjs/connectButtonHack/universal/findIconAndName.js +22 -14
  6. package/dist/cjs/connectButtonHack/universal/imgUtils.js +18 -8
  7. package/dist/cjs/connectButtonHack/universal/index.js +13 -11
  8. package/dist/cjs/connectButtonHack/universal/shadowRoot.js +14 -6
  9. package/dist/cjs/connectButtonHack/universal/textUtils.js +15 -7
  10. package/dist/cjs/connectButtonHack/universal/utils.js +16 -16
  11. package/dist/cjs/detectRiskWebsite/index.js +6 -15
  12. package/dist/cjs/detectRiskWebsite/style.js +9 -58
  13. package/dist/cjs/injectWeb3Provider.js +3 -1
  14. package/dist/connectButtonHack/index.js +0 -4
  15. package/dist/connectButtonHack/universal/config.d.ts +13 -2
  16. package/dist/connectButtonHack/universal/config.js +458 -9
  17. package/dist/connectButtonHack/universal/consts.d.ts +1 -0
  18. package/dist/connectButtonHack/universal/consts.js +1 -0
  19. package/dist/connectButtonHack/universal/findIconAndName.d.ts +9 -3
  20. package/dist/connectButtonHack/universal/findIconAndName.js +24 -16
  21. package/dist/connectButtonHack/universal/imgUtils.d.ts +3 -0
  22. package/dist/connectButtonHack/universal/imgUtils.js +18 -8
  23. package/dist/connectButtonHack/universal/index.js +15 -13
  24. package/dist/connectButtonHack/universal/shadowRoot.js +14 -6
  25. package/dist/connectButtonHack/universal/textUtils.d.ts +2 -2
  26. package/dist/connectButtonHack/universal/textUtils.js +15 -7
  27. package/dist/connectButtonHack/universal/utils.d.ts +7 -5
  28. package/dist/connectButtonHack/universal/utils.js +14 -11
  29. package/dist/detectRiskWebsite/index.js +6 -15
  30. package/dist/detectRiskWebsite/style.d.ts +1 -1
  31. package/dist/detectRiskWebsite/style.js +9 -58
  32. package/dist/injectWeb3Provider.d.ts +2 -1
  33. package/dist/injectWeb3Provider.js +4 -2
  34. package/package.json +19 -19
  35. package/LICENSE +0 -202
  36. package/dist/cjs/connectButtonHack/sites/pancake.js +0 -44
  37. package/dist/cjs/connectButtonHack/sites/stakestone.js +0 -41
  38. package/dist/connectButtonHack/sites/pancake.d.ts +0 -2
  39. package/dist/connectButtonHack/sites/pancake.js +0 -39
  40. package/dist/connectButtonHack/sites/stakestone.d.ts +0 -2
  41. package/dist/connectButtonHack/sites/stakestone.js +0 -36
package/LICENSE.md ADDED
@@ -0,0 +1,51 @@
1
+ # ONEKEY STANDARD SOURCE LICENSE (O-SSL)
2
+
3
+ This license governs use of the accompanying software. If you use the software,
4
+ you accept this license. If you do not accept the license, do not use the
5
+ software.
6
+
7
+ ## 1. Definitions
8
+
9
+ The terms "reproduce," "reproduction" and "distribution" have the same meaning
10
+ here as under Hong Kong copyright law.
11
+
12
+ "You" means the licensee of the software.
13
+
14
+ "Your company" means the company you worked for when you downloaded the
15
+ software.
16
+
17
+ "Reference use" means use of the software within your company as a reference,
18
+ in read only form, for the sole purposes of debugging your products,
19
+ maintaining your products, or enhancing the interoperability of your products
20
+ with the software, and specifically excludes the right to distribute the
21
+ software outside of your company.
22
+
23
+ "Licensed patents" means any Licensor patent claims which read directly on the
24
+ software as distributed by the Licensor under this license.
25
+
26
+ ## 2. Grant of Rights
27
+
28
+ (A) Copyright Grant - Subject to the terms of this license, the Licensor grants
29
+ you a non-transferable, non-exclusive, worldwide, royalty-free copyright
30
+ license to reproduce the software for reference use.
31
+
32
+ (B) Patent Grant - Subject to the terms of this license, the Licensor grants
33
+ you a non-transferable, non-exclusive, worldwide, royalty-free patent license
34
+ under licensed patents for reference use.
35
+
36
+ ## 3. Limitations
37
+
38
+ (A) No Trademark License - This license does not grant you any rights to use
39
+ the Licensor's name, logo, or trademarks.
40
+
41
+ (B) If you begin patent litigation against the Licensor over patents that you
42
+ think may apply to the software (including a cross-claim or counterclaim in
43
+ a lawsuit), your license to the software ends automatically.
44
+
45
+ (C) The software is licensed "as-is." You bear the risk of using it. The
46
+ Licensor gives no express warranties, guarantees or conditions. You may have
47
+ additional consumer rights under your local laws which this license cannot
48
+ change. To the extent permitted under your local laws, the Licensor excludes
49
+ the implied warranties of merchantability, fitness for a particular purpose and
50
+ non-infringement.This license agreement is governed by the laws of Hong Kong,
51
+ and any disputes related to this license agreement shall be resolved in accordance with Hong Kong law.
@@ -23,7 +23,6 @@ const yearn_1 = __importDefault(require("./sites/yearn"));
23
23
  const zapper_1 = __importDefault(require("./sites/zapper"));
24
24
  const zerion_1 = __importDefault(require("./sites/zerion"));
25
25
  const aave_1 = __importDefault(require("./sites/aave"));
26
- const pancake_1 = __importDefault(require("./sites/pancake"));
27
26
  const unisat_1 = __importDefault(require("./sites/unisat"));
28
27
  const gamma_1 = __importDefault(require("./sites/gamma"));
29
28
  const idclub_1 = __importDefault(require("./sites/idclub"));
@@ -37,7 +36,6 @@ const rocketpool_1 = __importDefault(require("./sites/rocketpool"));
37
36
  const avocado_1 = __importDefault(require("./sites/avocado"));
38
37
  const liteInstadapp_1 = __importDefault(require("./sites/liteInstadapp"));
39
38
  const methMantle_1 = __importDefault(require("./sites/methMantle"));
40
- const stakestone_1 = __importDefault(require("./sites/stakestone"));
41
39
  const balancerFi_1 = __importDefault(require("./sites/balancerFi"));
42
40
  const imtblTop_1 = __importDefault(require("./sites/imtblTop"));
43
41
  const renzoprotocol_1 = __importDefault(require("./sites/renzoprotocol"));
@@ -68,7 +66,6 @@ function hackAllConnectButtons() {
68
66
  (0, zapper_1.default)();
69
67
  (0, zerion_1.default)();
70
68
  (0, aave_1.default)();
71
- (0, pancake_1.default)();
72
69
  (0, unisat_1.default)();
73
70
  (0, gamma_1.default)();
74
71
  (0, idclub_1.default)();
@@ -82,7 +79,6 @@ function hackAllConnectButtons() {
82
79
  (0, avocado_1.default)();
83
80
  (0, liteInstadapp_1.default)();
84
81
  (0, methMantle_1.default)();
85
- (0, stakestone_1.default)();
86
82
  (0, balancerFi_1.default)();
87
83
  (0, imtblTop_1.default)();
88
84
  (0, renzoprotocol_1.default)();
@@ -63,6 +63,11 @@ exports.basicWalletInfo = {
63
63
  updatedName: consts_1.WALLET_CONNECT_INFO.martian.text,
64
64
  name: /^Martian$/i,
65
65
  },
66
+ [consts_1.WALLET_NAMES.nami]: {
67
+ updatedIcon: consts_1.WALLET_CONNECT_INFO.nami.icon,
68
+ updatedName: consts_1.WALLET_CONNECT_INFO.nami.text,
69
+ name: /^(Nami Wallet|Nami)$/i,
70
+ },
66
71
  };
67
72
  exports.sitesConfig = [
68
73
  {
@@ -324,6 +329,7 @@ exports.sitesConfig = [
324
329
  },
325
330
  {
326
331
  urls: ['merlinchain.io'],
332
+ skip: { mobile: true },
327
333
  walletsForProvider: {
328
334
  [cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
329
335
  Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { container: () => {
@@ -331,14 +337,22 @@ exports.sitesConfig = [
331
337
  return (window.getComputedStyle(e).pointerEvents != 'none' &&
332
338
  e.innerText.includes('BTC wallets'));
333
339
  });
340
+ }, afterUpdate(textNode, img) {
341
+ textNode.parentElement && (0, textUtils_1.makeTextEllipse)(textNode.parentElement);
334
342
  } }),
335
343
  ],
336
344
  },
337
345
  },
346
+ // todo:speed
338
347
  {
339
348
  urls: ['app.justlend.org'],
349
+ mutationObserverOptions: {
350
+ childList: true,
351
+ subtree: true,
352
+ attributes: true,
353
+ },
340
354
  walletsForProvider: {
341
- [cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
355
+ [cross_inpage_provider_types_1.IInjectedProviderNames.tron]: [
342
356
  Object.assign(Object.assign({}, exports.basicWalletInfo['tronlink']), { container: () => {
343
357
  return (0, utils_1.getConnectWalletModalByTitle)('div.connect-modal-v2.entry-modal-v2', 'Connect Wallet');
344
358
  } }),
@@ -351,7 +365,7 @@ exports.sitesConfig = [
351
365
  mobile: true, //WARN: it seems not supported by the site
352
366
  },
353
367
  walletsForProvider: {
354
- [cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
368
+ [cross_inpage_provider_types_1.IInjectedProviderNames.tron]: [
355
369
  Object.assign(Object.assign({}, exports.basicWalletInfo['tronlink']), { container: () => {
356
370
  return (0, utils_1.getConnectWalletModalByTitle)('div.wallet-modal', 'Connect Wallet');
357
371
  } }),
@@ -596,7 +610,7 @@ exports.sitesConfig = [
596
610
  Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
597
611
  const modal = (0, utils_1.getConnectWalletModalByTitle)('[data-testid="connectModal"]', 'Connect Your Wallet');
598
612
  return (modal &&
599
- (0, findIconAndName_1.findIconAndNameDirectly)('svg[aria-label="metamask-icon"]', (icon) => icon.parentElement, name, modal));
613
+ (0, findIconAndName_1.findIconAndNameDirectly)('svg[aria-label="metamask-icon"]', 'auto-search-text', name, modal));
600
614
  } }),
601
615
  ],
602
616
  },
@@ -635,13 +649,16 @@ exports.sitesConfig = [
635
649
  {
636
650
  urls: ['app.carbondefi.xyz'],
637
651
  testPath: ['button:text("Accept All Cookies")', 'button:text("Connect Wallet")'],
638
- skip: true,
652
+ // skip: true, //TODO:bug:未触发弹窗
639
653
  walletsForProvider: {
640
654
  [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
641
655
  Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
642
656
  const modal = (0, utils_1.getConnectWalletModalByTitle)('div[data-testid="modal-container"]', 'Connect Wallet');
643
657
  return (modal &&
644
- (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="assets/metamask"]', (icon) => icon.parentElement, name, modal));
658
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="assets/metamask"]', 'auto-search-text', name, modal));
659
+ },
660
+ afterUpdate(text, imgNode) {
661
+ imgNode.style.height = 'auto';
645
662
  } }),
646
663
  Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
647
664
  var _a;
@@ -655,6 +672,9 @@ exports.sitesConfig = [
655
672
  iconNode: icon,
656
673
  textNode: text,
657
674
  });
675
+ },
676
+ afterUpdate(text, imgNode) {
677
+ imgNode.style.height = 'auto';
658
678
  } }),
659
679
  ],
660
680
  },
@@ -1048,4 +1068,433 @@ exports.sitesConfig = [
1048
1068
  ],
1049
1069
  },
1050
1070
  },
1071
+ {
1072
+ urls: ['ambient.finance'],
1073
+ testPath: {
1074
+ desktop: [':text("Connect Wallet")', 'button:text("Agree")'],
1075
+ mobile: [':text("Connect")', 'button:text("Agree")'], //TODO:点击不了Agree.
1076
+ },
1077
+ walletsForProvider: {
1078
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1079
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'button[aria-label*="connect to MetaMask"][class*="WalletButton_container"]' }),
1080
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: 'button[aria-label*="connect to WalletConnect"][class*="WalletButton_container"]' }),
1081
+ ],
1082
+ },
1083
+ },
1084
+ {
1085
+ urls: ['app.hydroprotocol.finance'],
1086
+ walletsForProvider: {
1087
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1088
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), {
1089
+ //没有稳定的选择器可用
1090
+ findIconAndName({ name }) {
1091
+ return (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="metamask"][alt="Metamask"]', 'auto-search-text', name);
1092
+ } }),
1093
+ ],
1094
+ [cross_inpage_provider_types_1.IInjectedProviderNames.cosmos]: [
1095
+ Object.assign(Object.assign({}, exports.basicWalletInfo['keplr']), { findIconAndName({ name }) {
1096
+ return (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="keplr"][alt="Keplr"]', 'auto-search-text', name);
1097
+ } }),
1098
+ ],
1099
+ },
1100
+ },
1101
+ {
1102
+ urls: ['biswap.org'],
1103
+ testPath: ['button.closeModal', ':text("Later")', 'button:text("Connect Wallet")'],
1104
+ walletsForProvider: {
1105
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1106
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'button#wallet-connect-metamask', afterUpdate(textNode, updatedName) {
1107
+ textNode.parentElement && (0, textUtils_1.makeTextEllipse)(textNode.parentElement);
1108
+ } }),
1109
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: 'button#wallet-connect-walletconnect', afterUpdate(textNode, updatedName) {
1110
+ textNode.parentElement && (0, textUtils_1.makeTextEllipse)(textNode.parentElement);
1111
+ } }),
1112
+ ],
1113
+ },
1114
+ },
1115
+ {
1116
+ urls: ['app.pangolin.exchange'],
1117
+ testPath: ['#connect-wallet'],
1118
+ skip: { mobile: true },
1119
+ walletsForProvider: {
1120
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1121
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1122
+ //modal:没有稳定的选择器
1123
+ return (0, findIconAndName_1.findIconAndNameDirectly)('img[alt="Metamask Logo"][title="Metamask"]', 'auto-search-text', name);
1124
+ } }),
1125
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
1126
+ //modal:没有稳定的选择器
1127
+ return (0, findIconAndName_1.findIconAndNameDirectly)('img[alt="WalletConnect Logo"][title="WalletConnect"]', 'auto-search-text', name);
1128
+ } }),
1129
+ ],
1130
+ },
1131
+ },
1132
+ {
1133
+ urls: ['lybra.finance'],
1134
+ testPath: {
1135
+ desktop: [':text("Launch App")', ':text("Connect Wallet")'],
1136
+ mobile: [
1137
+ '[class*="header_menuIcon"][src*="menu"]',
1138
+ ':text("Launch App")',
1139
+ ':text("Connect Wallet")',
1140
+ ],
1141
+ },
1142
+ walletsForProvider: {
1143
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1144
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'button[data-testid="rk-wallet-option-metaMask"]' }),
1145
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: 'button[data-testid="rk-wallet-option-walletConnect"]' }),
1146
+ ],
1147
+ },
1148
+ },
1149
+ {
1150
+ urls: ['app.wagmi.com'],
1151
+ constraintMap: { icon: [imgUtils_1.isWalletIconSizeMatch], text: [] },
1152
+ walletsForProvider: {
1153
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1154
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: '#wallet-dropdown-scroll-wrapper' }),
1155
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: '#wallet-dropdown-scroll-wrapper' }),
1156
+ ],
1157
+ },
1158
+ },
1159
+ {
1160
+ urls: ['app.ease.org'],
1161
+ testPath: [':text("NOT NOW")', ':text("CONNECT")'],
1162
+ walletsForProvider: {
1163
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1164
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1165
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('#headlessui-portal-root', 'Connect your Wallet');
1166
+ return (modal &&
1167
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="metamask.svg"][alt="MetaMask"]', 'auto-search-text', name, modal));
1168
+ } }),
1169
+ // {
1170
+ // ...basicWalletInfo['tronlink'],
1171
+ // findIconAndName({ name }) {
1172
+ // const modal = getConnectWalletModalByTitle(
1173
+ // '#headlessui-portal-root',
1174
+ // 'Connect your Wallet',
1175
+ // );
1176
+ // return (
1177
+ // modal &&
1178
+ // findIconAndNameDirectly(
1179
+ // 'img[src*="trustWallet"][alt="TrustWallet"]',
1180
+ // 'auto-search-text',
1181
+ // name,
1182
+ // modal,
1183
+ // )
1184
+ // );
1185
+ // },
1186
+ // },
1187
+ ],
1188
+ },
1189
+ },
1190
+ {
1191
+ urls: ['www.theidols.io'],
1192
+ skip: {
1193
+ mobile: true, //没弹窗
1194
+ },
1195
+ testUrls: ['www.theidols.io/marketplace'],
1196
+ walletsForProvider: {
1197
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1198
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: '#WEB3_CONNECT_MODAL_ID .web3modal-modal-container' }),
1199
+ ],
1200
+ },
1201
+ },
1202
+ {
1203
+ urls: ['netswap.io'],
1204
+ skip: {
1205
+ mobile: true, //没弹窗
1206
+ },
1207
+ walletsForProvider: {
1208
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1209
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: '#connect-METAMASK' }),
1210
+ ],
1211
+ },
1212
+ },
1213
+ {
1214
+ urls: ['rosswap.com'],
1215
+ constraintMap: { icon: [imgUtils_1.isWalletIconSizeMatch], text: [] },
1216
+ skip: {
1217
+ mobile: true, //没弹窗
1218
+ },
1219
+ // skip:
1220
+ walletsForProvider: {
1221
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1222
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: '#connect-METAMASK' }),
1223
+ ],
1224
+ },
1225
+ },
1226
+ {
1227
+ urls: ['maiadao.io'],
1228
+ constraintMap: { icon: [imgUtils_1.isWalletIconSizeMatch], text: [] },
1229
+ skip: {
1230
+ mobile: true, //没弹窗
1231
+ },
1232
+ walletsForProvider: {
1233
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1234
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: '#connect-METAMASK' }),
1235
+ ],
1236
+ },
1237
+ },
1238
+ {
1239
+ urls: ['diva.shamirlabs.org'],
1240
+ walletsForProvider: {
1241
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1242
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'button[data-testid="rk-wallet-option-metaMask"]' }),
1243
+ ],
1244
+ },
1245
+ },
1246
+ {
1247
+ urls: ['www.convexfinance.com'],
1248
+ skip: true,
1249
+ walletsForProvider: {
1250
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1251
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { update({ updatedName, name }) {
1252
+ const modal = document.querySelector('#wallet-info-dropdown ul');
1253
+ const textNode = (0, textUtils_1.findWalletTextByParent)(modal, name, [utils_1.isClickable]);
1254
+ const newTextNode = textNode && (0, textUtils_1.replaceText)(textNode, updatedName);
1255
+ (newTextNode === null || newTextNode === void 0 ? void 0 : newTextNode.parentElement) && (0, textUtils_1.makeTextEllipse)(newTextNode === null || newTextNode === void 0 ? void 0 : newTextNode.parentElement);
1256
+ return null;
1257
+ } }),
1258
+ ],
1259
+ },
1260
+ },
1261
+ {
1262
+ urls: ['www.staderlabs.com'],
1263
+ skip: {
1264
+ mobile: true, //tmp skip for lack walletconnet
1265
+ },
1266
+ testUrls: ['www.staderlabs.com/eth/stake/'],
1267
+ constraintMap: { icon: [imgUtils_1.isWalletIconSizeMatch], text: [] },
1268
+ walletsForProvider: {
1269
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1270
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1271
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('.chakra-modal__content-container', 'Select wallet') ||
1272
+ (0, utils_1.getConnectWalletModalByTitle)('#__CONNECTKIT__', 'Connect Wallet');
1273
+ if (!modal) {
1274
+ return null;
1275
+ }
1276
+ return ((0, findIconAndName_1.findIconAndNameByParent)(modal, name, {
1277
+ text: [],
1278
+ icon: [],
1279
+ }) ||
1280
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="media/mm"][alt="metaMask Logo"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
1281
+ },
1282
+ afterUpdate(text, icon) {
1283
+ var _a;
1284
+ const parent = (_a = text.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
1285
+ const imgContainer = parent === null || parent === void 0 ? void 0 : parent.firstChild;
1286
+ if (parent && imgContainer) {
1287
+ imgContainer.style.display = 'flex';
1288
+ imgContainer.style.alignItems = 'center';
1289
+ imgContainer.style.borderRadius = '0';
1290
+ imgContainer.style.flexShrink = '0';
1291
+ }
1292
+ } }),
1293
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
1294
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('.chakra-modal__content-container', 'Select wallet') ||
1295
+ (0, utils_1.getConnectWalletModalByTitle)('#__CONNECTKIT__', 'Connect Wallet');
1296
+ if (!modal) {
1297
+ return null;
1298
+ }
1299
+ return (0, findIconAndName_1.findIconAndNameDirectly)('img[alt="walletConnect Logo"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5);
1300
+ },
1301
+ afterUpdate(text, icon) {
1302
+ var _a;
1303
+ const parent = (_a = text.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
1304
+ const imgContainer = parent === null || parent === void 0 ? void 0 : parent.firstChild;
1305
+ if (parent && imgContainer) {
1306
+ imgContainer.style.display = 'flex';
1307
+ imgContainer.style.alignItems = 'center';
1308
+ imgContainer.style.borderRadius = '0';
1309
+ imgContainer.style.flexShrink = '0';
1310
+ }
1311
+ } }),
1312
+ ],
1313
+ },
1314
+ },
1315
+ {
1316
+ urls: ['stake.solblaze.org'],
1317
+ testPath: [':text("Agree")', ':text("Connect Wallet")'],
1318
+ testUrls: ['stake.solblaze.org/app'],
1319
+ walletsForProvider: {
1320
+ [cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
1321
+ Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { container: '#connect_modal', afterUpdate(text, icon) {
1322
+ var _a;
1323
+ if ((_a = text.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) {
1324
+ text.parentElement.parentElement.style.whiteSpace = 'noWrap';
1325
+ (0, textUtils_1.makeTextEllipse)(text.parentElement, 'min(18vw,107px)');
1326
+ }
1327
+ } }),
1328
+ ],
1329
+ },
1330
+ },
1331
+ {
1332
+ urls: ['buzz.bsquared.network'],
1333
+ skip: true,
1334
+ walletsForProvider: {
1335
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1336
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('.modalContent', 'Connect Wallet') }),
1337
+ ],
1338
+ [cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
1339
+ Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { findIconAndName({ name }) {
1340
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('.modalContent', 'Connect Wallet');
1341
+ return (modal &&
1342
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="layout/unisat.png"]', 'auto-search-text', name));
1343
+ } }),
1344
+ ],
1345
+ },
1346
+ },
1347
+ {
1348
+ urls: ['task.bsquared.network'],
1349
+ skip: { mobile: true },
1350
+ walletsForProvider: {
1351
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1352
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('.ReactModal__Content', 'Please Connect A Wallet') }),
1353
+ ],
1354
+ [cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
1355
+ Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('.ReactModal__Content', 'Please Connect A Wallet') }),
1356
+ ],
1357
+ },
1358
+ },
1359
+ {
1360
+ urls: ['juststable.tronscan.org'],
1361
+ testPath: [':text("Enter")'],
1362
+ skip: true,
1363
+ walletsForProvider: {
1364
+ [cross_inpage_provider_types_1.IInjectedProviderNames.tron]: [
1365
+ Object.assign(Object.assign({}, exports.basicWalletInfo['tronlink']), { update({ name, updatedName, updatedIcon }) {
1366
+ const button = document.querySelector('button.ant-btn.tronlinkLogin');
1367
+ const text = button && (0, textUtils_1.findWalletTextByParent)(button, name, []);
1368
+ text && (0, textUtils_1.replaceText)(text, updatedName);
1369
+ button && (button.style.backgroundImage = `url(${updatedIcon})`);
1370
+ return null;
1371
+ } }),
1372
+ ],
1373
+ },
1374
+ },
1375
+ {
1376
+ urls: ['app.cetus.zone'],
1377
+ testPath: ['div.radio', 'button:has-text("Continue")', 'button:has-text("Connect Wallet")'],
1378
+ walletsForProvider: {
1379
+ [cross_inpage_provider_types_1.IInjectedProviderNames.aptos]: [
1380
+ Object.assign(Object.assign({}, exports.basicWalletInfo['martian']), { container: 'div.ant-modal.wallet-modal' }),
1381
+ //petra不存在
1382
+ // {
1383
+ // ...basicWalletInfo['petra'],
1384
+ // container: 'div.ant-modal.wallet-modal',
1385
+ // },
1386
+ ],
1387
+ [cross_inpage_provider_types_1.IInjectedProviderNames.sui]: [
1388
+ Object.assign(Object.assign({}, exports.basicWalletInfo['suiwallet']), { name: /^Sui Wallet$/i, container: 'div.ant-modal.wallet-modal' }),
1389
+ ],
1390
+ },
1391
+ },
1392
+ //全是shadow dom
1393
+ // {
1394
+ // urls: ['www.pinksale.finance'],
1395
+ // walletsForProvider: {
1396
+ // [IInjectedProviderNames.ethereum]: [
1397
+ // {
1398
+ // ...basicWalletInfo['metamask'],
1399
+ // },
1400
+ // {
1401
+ // ...basicWalletInfo['walletconnect'],
1402
+ // },
1403
+ // ],
1404
+ // },
1405
+ // },
1406
+ {
1407
+ urls: ['app.radiant.capital'],
1408
+ testPath: [':text("Continue")', ':text("Connect Wallet")'],
1409
+ walletsForProvider: {
1410
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1411
+ Object.assign(Object.assign({ container: '.connect-wallet-modal' }, exports.basicWalletInfo['walletconnect']), { afterUpdate(textNode, img) {
1412
+ img.style.height = '40px';
1413
+ img.style.width = '40px';
1414
+ } }),
1415
+ ],
1416
+ },
1417
+ },
1418
+ {
1419
+ urls: ['app.ariesmarkets.xyz'],
1420
+ testUrls: ['app.ariesmarkets.xyz/lending'],
1421
+ // mutationObserverOptions: {
1422
+ // childList: true,
1423
+ // subtree: true,
1424
+ // attributes: true,
1425
+ // },
1426
+ //TODO: mobile version
1427
+ constraintMap: { icon: [imgUtils_1.isWalletIconSizeMatch], text: [] },
1428
+ walletsForProvider: {
1429
+ [cross_inpage_provider_types_1.IInjectedProviderNames.aptos]: [
1430
+ Object.assign(Object.assign({}, exports.basicWalletInfo['petra']), { container: () => {
1431
+ var _a, _b, _c;
1432
+ const pc = (0, utils_1.getConnectWalletModalByTitle)('div.mantine-Paper-root', 'Select Wallet');
1433
+ const mobileTitle = utilsDomNodes_1.default.findTextNode('#root', 'Select Wallet', 'first') || null;
1434
+ return (pc || ((_c = (_b = (_a = mobileTitle === null || mobileTitle === void 0 ? void 0 : mobileTitle.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.parentElement) || null);
1435
+ } }),
1436
+ ],
1437
+ },
1438
+ },
1439
+ {
1440
+ urls: ['app.indigoprotocol.io'],
1441
+ // testPath: [':text("I agree")', ':text("Connect")'],
1442
+ constraintMap: { icon: [], text: [] },
1443
+ walletsForProvider: {
1444
+ [cross_inpage_provider_types_1.IInjectedProviderNames.cardano]: [
1445
+ Object.assign(Object.assign({}, exports.basicWalletInfo['nami']), { container: () => {
1446
+ return (0, utils_1.getConnectWalletModalByTitle)('#modal-connect-wallet', 'Connect Wallet');
1447
+ } }),
1448
+ ],
1449
+ },
1450
+ },
1451
+ {
1452
+ urls: ['app.minswap.org'],
1453
+ testPath: {
1454
+ desktop: [':text("Connect Wallet")'],
1455
+ mobile: ['header.flex > button>svg', ':text("Connect Wallet")'],
1456
+ },
1457
+ skip: true,
1458
+ walletsForProvider: {
1459
+ [cross_inpage_provider_types_1.IInjectedProviderNames.cardano]: [
1460
+ Object.assign(Object.assign({}, exports.basicWalletInfo['nami']), { findIconAndName({ name }) {
1461
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('div.dialog-connect-wallet', 'Connect wallet');
1462
+ return (modal &&
1463
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="nami.svg"][alt="Nami"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 6));
1464
+ } }),
1465
+ ],
1466
+ },
1467
+ },
1468
+ {
1469
+ urls: ['pancakeswap.finance', 'app.pancakeswap.finance', 'www.pancakeswap.finance'],
1470
+ skip: {
1471
+ mobile: true, //temp skip for lack walletconnect
1472
+ },
1473
+ walletsForProvider: {
1474
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1475
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1476
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('#portal-root', 'Connect Wallet');
1477
+ return (modal &&
1478
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="wallets/metamask.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
1479
+ } }),
1480
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { findIconAndName({ name }) {
1481
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('#portal-root', 'Connect Wallet');
1482
+ return (modal &&
1483
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="wallets/walletconnect.png"]', 'auto-search-text', name, modal, { text: [], icon: [] }, 5));
1484
+ } }),
1485
+ ],
1486
+ },
1487
+ },
1488
+ {
1489
+ urls: ['www.nucleon.space'],
1490
+ testUrls: ['www.nucleon.space/#/data/stake'],
1491
+ walletsForProvider: {
1492
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1493
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('div.ant-modal-content', 'Select a Wallet'), afterUpdate(textNode, icon) {
1494
+ icon.style.height = '28px';
1495
+ icon.style.width = 'auto';
1496
+ } }),
1497
+ ],
1498
+ },
1499
+ },
1051
1500
  ];
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALIGN_THRESHOLD = exports.ICON_MIN_SIZE = exports.ICON_MAX_SIZE = exports.DISTNACE_BETWEEN_ICON_AND_TEXT = exports.MAX_LEVELS = void 0;
3
+ exports.ALIGN_THRESHOLD = exports.ICON_MIN_SIZE = exports.ICON_MAX_SIZE = exports.DISTNACE_BETWEEN_ICON_AND_TEXT = exports.MAX_SEARCH_LEVELS_By_IMG = exports.MAX_LEVELS = void 0;
4
4
  exports.MAX_LEVELS = 4;
5
+ exports.MAX_SEARCH_LEVELS_By_IMG = 3;
5
6
  exports.DISTNACE_BETWEEN_ICON_AND_TEXT = 100;
6
7
  exports.ICON_MAX_SIZE = 150;
7
8
  exports.ICON_MIN_SIZE = 10;