@onekeyfe/inpage-providers-hub 2.2.22 → 2.2.23
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 +255 -19
- package/dist/cjs/connectButtonHack/universal/findIconAndName.js +2 -2
- package/dist/cjs/connectButtonHack/universal/imgUtils.js +4 -1
- package/dist/cjs/injectWeb3Provider.js +6 -4
- package/dist/connectButtonHack/universal/config.js +255 -19
- package/dist/connectButtonHack/universal/findIconAndName.d.ts +1 -1
- package/dist/connectButtonHack/universal/findIconAndName.js +2 -2
- package/dist/connectButtonHack/universal/imgUtils.d.ts +1 -1
- package/dist/connectButtonHack/universal/imgUtils.js +4 -1
- package/dist/injectWeb3Provider.js +7 -5
- package/package.json +23 -23
|
@@ -1935,10 +1935,16 @@ exports.sitesConfig = [
|
|
|
1935
1935
|
testPath: [':text("CONNECT WALLET")'],
|
|
1936
1936
|
walletsForProvider: {
|
|
1937
1937
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
1938
|
-
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1938
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1939
|
+
'Connect Wallet',
|
|
1940
|
+
'Wallet Overview',
|
|
1941
|
+
]) }),
|
|
1939
1942
|
],
|
|
1940
1943
|
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
1941
|
-
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1944
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1945
|
+
'Connect Wallet',
|
|
1946
|
+
'Wallet Overview',
|
|
1947
|
+
]) }),
|
|
1942
1948
|
],
|
|
1943
1949
|
},
|
|
1944
1950
|
},
|
|
@@ -2918,7 +2924,8 @@ exports.sitesConfig = [
|
|
|
2918
2924
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
2919
2925
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
2920
2926
|
const modal = document.querySelector('div[role="dialog"].fixed.inset-0');
|
|
2921
|
-
return modal &&
|
|
2927
|
+
return (modal &&
|
|
2928
|
+
(0, findIconAndName_1.findIconAndNameByIcon)('img[alt="MetaMask"]', 'auto-search-text', name, modal));
|
|
2922
2929
|
} }),
|
|
2923
2930
|
],
|
|
2924
2931
|
},
|
|
@@ -2930,13 +2937,14 @@ exports.sitesConfig = [
|
|
|
2930
2937
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'div[role="dialog"]', findIconAndName({ name }) {
|
|
2931
2938
|
var _a;
|
|
2932
2939
|
const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Connect your wallet');
|
|
2933
|
-
return (_a = (modal &&
|
|
2934
|
-
icon
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
+
return ((_a = (modal &&
|
|
2941
|
+
(0, findIconAndName_1.findIconAndNameByName)(modal, name, 'auto-search-icon', {
|
|
2942
|
+
icon: [
|
|
2943
|
+
imgUtils_1.isWalletIconLessEqualThan,
|
|
2944
|
+
(icon) => icon.getAttribute('aria-hidden') !== 'true',
|
|
2945
|
+
],
|
|
2946
|
+
text: [],
|
|
2947
|
+
}))) !== null && _a !== void 0 ? _a : null);
|
|
2940
2948
|
} }),
|
|
2941
2949
|
],
|
|
2942
2950
|
},
|
|
@@ -2978,7 +2986,8 @@ exports.sitesConfig = [
|
|
|
2978
2986
|
[cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
|
|
2979
2987
|
Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { findIconAndName({ name }) {
|
|
2980
2988
|
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.dropdown.dropdown-end', 'Connect Wallet');
|
|
2981
|
-
return modal &&
|
|
2989
|
+
return (modal &&
|
|
2990
|
+
(0, findIconAndName_1.findIconAndNameByIcon)('img[alt="Unisat Wallet"]', 'auto-search-text', name, modal));
|
|
2982
2991
|
},
|
|
2983
2992
|
afterUpdate(textNode, iconNode) {
|
|
2984
2993
|
if (textNode) {
|
|
@@ -3008,12 +3017,10 @@ exports.sitesConfig = [
|
|
|
3008
3017
|
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3009
3018
|
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3010
3019
|
var _a;
|
|
3011
|
-
return (_a = (0, findIconAndName_1.findIconAndNameByName)(document.body, name, 'auto-search-icon', {
|
|
3012
|
-
icon: [
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
text: []
|
|
3016
|
-
})) !== null && _a !== void 0 ? _a : null;
|
|
3020
|
+
return ((_a = (0, findIconAndName_1.findIconAndNameByName)(document.body, name, 'auto-search-icon', {
|
|
3021
|
+
icon: [(icon) => icon.classList.contains('chakra-icon')],
|
|
3022
|
+
text: [],
|
|
3023
|
+
})) !== null && _a !== void 0 ? _a : null);
|
|
3017
3024
|
} }),
|
|
3018
3025
|
],
|
|
3019
3026
|
},
|
|
@@ -3083,7 +3090,7 @@ exports.sitesConfig = [
|
|
|
3083
3090
|
urls: ['app.streamflow.finance'],
|
|
3084
3091
|
walletsForProvider: {
|
|
3085
3092
|
[cross_inpage_provider_types_1.IInjectedProviderNames.sui]: [
|
|
3086
|
-
Object.assign(Object.assign({}, exports.basicWalletInfo['suiwallet']), { container:
|
|
3093
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['suiwallet']), { container: 'div.w-full.sm\\:w-100' }),
|
|
3087
3094
|
],
|
|
3088
3095
|
},
|
|
3089
3096
|
},
|
|
@@ -3093,7 +3100,8 @@ exports.sitesConfig = [
|
|
|
3093
3100
|
[cross_inpage_provider_types_1.IInjectedProviderNames.sui]: [
|
|
3094
3101
|
Object.assign(Object.assign({}, exports.basicWalletInfo['suiwallet']), { findIconAndName({ name }) {
|
|
3095
3102
|
const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Connect a Wallet from list');
|
|
3096
|
-
return modal &&
|
|
3103
|
+
return (modal &&
|
|
3104
|
+
(0, findIconAndName_1.findIconAndNameByIcon)('img[alt="Sui Wallet"]', 'auto-search-text', name, modal));
|
|
3097
3105
|
} }),
|
|
3098
3106
|
],
|
|
3099
3107
|
},
|
|
@@ -3195,4 +3203,232 @@ exports.sitesConfig = [
|
|
|
3195
3203
|
],
|
|
3196
3204
|
},
|
|
3197
3205
|
},
|
|
3206
|
+
{
|
|
3207
|
+
urls: ['app.squidrouter.com'],
|
|
3208
|
+
walletsForProvider: {
|
|
3209
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3210
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3211
|
+
var _a, _b;
|
|
3212
|
+
return ((_b = (0, findIconAndName_1.findIconAndNameByName)((_a = document.querySelector('aside section ul')) !== null && _a !== void 0 ? _a : document.body, name, 'auto-search-icon-first')) !== null && _b !== void 0 ? _b : null);
|
|
3213
|
+
} }),
|
|
3214
|
+
],
|
|
3215
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
|
|
3216
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { findIconAndName({ name }) {
|
|
3217
|
+
var _a, _b;
|
|
3218
|
+
return ((_b = (0, findIconAndName_1.findIconAndNameByName)((_a = document.querySelector('aside section ul')) !== null && _a !== void 0 ? _a : document.body, name, 'auto-search-icon-first')) !== null && _b !== void 0 ? _b : null);
|
|
3219
|
+
} }),
|
|
3220
|
+
],
|
|
3221
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3222
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3223
|
+
var _a, _b;
|
|
3224
|
+
return ((_b = (0, findIconAndName_1.findIconAndNameByName)((_a = document.querySelector('aside section ul')) !== null && _a !== void 0 ? _a : document.body, name, 'auto-search-icon-first')) !== null && _b !== void 0 ? _b : null);
|
|
3225
|
+
} }),
|
|
3226
|
+
],
|
|
3227
|
+
},
|
|
3228
|
+
},
|
|
3229
|
+
{
|
|
3230
|
+
urls: ['portal.bouncebit.io'],
|
|
3231
|
+
walletsForProvider: {
|
|
3232
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3233
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName(wallet) {
|
|
3234
|
+
return (0, findIconAndName_1.findIconAndNameByIcon)(() => {
|
|
3235
|
+
var _a;
|
|
3236
|
+
return (_a = Array.from(document.querySelectorAll('img[src*="/images/wallet/metamask.png"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3237
|
+
}, 'auto-search-text', wallet.name);
|
|
3238
|
+
} }),
|
|
3239
|
+
],
|
|
3240
|
+
},
|
|
3241
|
+
},
|
|
3242
|
+
{
|
|
3243
|
+
urls: ['obelisk.nodedao.com'],
|
|
3244
|
+
walletsForProvider: {
|
|
3245
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
|
|
3246
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { findIconAndName({ name }) {
|
|
3247
|
+
var _a;
|
|
3248
|
+
return (_a = (0, findIconAndName_1.findIconAndNameByName)(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3249
|
+
} }),
|
|
3250
|
+
],
|
|
3251
|
+
},
|
|
3252
|
+
},
|
|
3253
|
+
{
|
|
3254
|
+
urls: ['dapp.tokenbridge.rootstock.io', 'hive.bsquared.network', 'portal.bouncebit.io', 'www.lolik.com'],
|
|
3255
|
+
walletsForProvider: {
|
|
3256
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3257
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3258
|
+
var _a;
|
|
3259
|
+
return (_a = (0, findIconAndName_1.findIconAndNameByName)(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3260
|
+
} }),
|
|
3261
|
+
],
|
|
3262
|
+
},
|
|
3263
|
+
},
|
|
3264
|
+
{
|
|
3265
|
+
urls: ['bridge.metis.io'],
|
|
3266
|
+
walletsForProvider: {
|
|
3267
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3268
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3269
|
+
var _a;
|
|
3270
|
+
const modal = (0, utils_1.getConnectWalletModalByTitle)('div.sc-iGgWBj.jEkttQ', 'Connect your wallet');
|
|
3271
|
+
return (_a = (modal && (0, findIconAndName_1.findIconAndNameByName)(modal, /.*meta\s*mask$/i, 'auto-search-icon'))) !== null && _a !== void 0 ? _a : null;
|
|
3272
|
+
} }),
|
|
3273
|
+
],
|
|
3274
|
+
},
|
|
3275
|
+
},
|
|
3276
|
+
{
|
|
3277
|
+
urls: ['lista.org'],
|
|
3278
|
+
walletsForProvider: {
|
|
3279
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3280
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3281
|
+
var _a, _b;
|
|
3282
|
+
const modal = document.querySelector('div[role="alertdialog"]');
|
|
3283
|
+
const text = modal && (0, textUtils_1.findWalletTextByParent)(modal, name, []);
|
|
3284
|
+
const icon = (_b = (_a = text === null || text === void 0 ? void 0 : text.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.querySelector('img');
|
|
3285
|
+
return (text && {
|
|
3286
|
+
textNode: text,
|
|
3287
|
+
iconNode: icon !== null && icon !== void 0 ? icon : null,
|
|
3288
|
+
});
|
|
3289
|
+
} }),
|
|
3290
|
+
],
|
|
3291
|
+
},
|
|
3292
|
+
},
|
|
3293
|
+
{
|
|
3294
|
+
urls: ['app.coffer.network'],
|
|
3295
|
+
walletsForProvider: {
|
|
3296
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.btc]: [
|
|
3297
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['unisat']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('div.ant-web3-connect-modal-body.css-ccdg5a', 'Connect Wallet') }),
|
|
3298
|
+
],
|
|
3299
|
+
},
|
|
3300
|
+
},
|
|
3301
|
+
{
|
|
3302
|
+
urls: ['www.stakedao.org'],
|
|
3303
|
+
walletsForProvider: {
|
|
3304
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3305
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName(wallet) {
|
|
3306
|
+
var _a;
|
|
3307
|
+
const iconNode = (_a = Array.from(document.querySelectorAll('img[alt="metamask wallet logo"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3308
|
+
// 创建一个空的文本节点
|
|
3309
|
+
return iconNode ? {
|
|
3310
|
+
textNode: document.createTextNode(''),
|
|
3311
|
+
iconNode: iconNode
|
|
3312
|
+
} : null;
|
|
3313
|
+
} }),
|
|
3314
|
+
],
|
|
3315
|
+
},
|
|
3316
|
+
},
|
|
3317
|
+
{
|
|
3318
|
+
urls: ['www.babylon.magpiexyz.io', 'homora-v2.alphaventuredao.io', 'app.yei.finance', 'portal.bouncebit.io'],
|
|
3319
|
+
walletsForProvider: {
|
|
3320
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3321
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3322
|
+
var _a;
|
|
3323
|
+
return (_a = (0, findIconAndName_1.findIconAndNameByName)(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3324
|
+
} }),
|
|
3325
|
+
],
|
|
3326
|
+
},
|
|
3327
|
+
},
|
|
3328
|
+
{
|
|
3329
|
+
urls: ['exsat.network'],
|
|
3330
|
+
mutationObserverOptions: {
|
|
3331
|
+
childList: true,
|
|
3332
|
+
subtree: true,
|
|
3333
|
+
attributes: true,
|
|
3334
|
+
},
|
|
3335
|
+
constraintMap: {
|
|
3336
|
+
icon: [imgUtils_1.isWalletIconLessEqualThan],
|
|
3337
|
+
text: [],
|
|
3338
|
+
},
|
|
3339
|
+
walletsForProvider: {
|
|
3340
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
|
|
3341
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3342
|
+
var _a;
|
|
3343
|
+
const modal = document.querySelector('.ant-modal-body');
|
|
3344
|
+
return (_a = (modal && (0, findIconAndName_1.findIconAndNameByName)(modal, name, 'auto-search-icon', {
|
|
3345
|
+
icon: [imgUtils_1.isWalletIconLessEqualThan],
|
|
3346
|
+
text: []
|
|
3347
|
+
}))) !== null && _a !== void 0 ? _a : null;
|
|
3348
|
+
} }),
|
|
3349
|
+
],
|
|
3350
|
+
},
|
|
3351
|
+
},
|
|
3352
|
+
{
|
|
3353
|
+
urls: ['app.pluto.so'],
|
|
3354
|
+
walletsForProvider: {
|
|
3355
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3356
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3357
|
+
return (0, findIconAndName_1.findIconAndNameByIcon)(() => {
|
|
3358
|
+
var _a;
|
|
3359
|
+
return (_a = Array.from(document.querySelectorAll('img[alt="phantom wallet"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3360
|
+
}, 'auto-search-text', wallet.name);
|
|
3361
|
+
} }),
|
|
3362
|
+
],
|
|
3363
|
+
},
|
|
3364
|
+
},
|
|
3365
|
+
{
|
|
3366
|
+
urls: ['app.cega.fi', 'parrot.fi', 'app.rate-x.io', 'app.meteora.ag', 'app.fragmetric.xyz', 'app.apricot.one',
|
|
3367
|
+
'dex.saros.xyz', 'tulip.garden'],
|
|
3368
|
+
walletsForProvider: {
|
|
3369
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3370
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3371
|
+
var _a;
|
|
3372
|
+
return (_a = (0, findIconAndName_1.findIconAndNameByName)(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3373
|
+
} }),
|
|
3374
|
+
],
|
|
3375
|
+
},
|
|
3376
|
+
},
|
|
3377
|
+
{
|
|
3378
|
+
urls: ['app.adrena.xyz'],
|
|
3379
|
+
walletsForProvider: {
|
|
3380
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3381
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3382
|
+
const textNodes = utilsDomNodes_1.default.findTextNode(document.body, name, 'all');
|
|
3383
|
+
const textNode = textNodes === null || textNodes === void 0 ? void 0 : textNodes.find(node => node.parentElement && (0, utils_1.isVisible)(node.parentElement));
|
|
3384
|
+
return (textNode === null || textNode === void 0 ? void 0 : textNode.parentElement) ? {
|
|
3385
|
+
textNode: textNode,
|
|
3386
|
+
iconNode: textNode.parentElement
|
|
3387
|
+
} : null;
|
|
3388
|
+
} }),
|
|
3389
|
+
],
|
|
3390
|
+
},
|
|
3391
|
+
},
|
|
3392
|
+
{
|
|
3393
|
+
urls: ['swap.pump.fun'],
|
|
3394
|
+
walletsForProvider: {
|
|
3395
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3396
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3397
|
+
var _a;
|
|
3398
|
+
return (_a = (0, findIconAndName_1.findIconAndNameByName)(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3399
|
+
},
|
|
3400
|
+
afterUpdate(textNode) {
|
|
3401
|
+
if (textNode) {
|
|
3402
|
+
textNode.textContent = 'Onekey&Phantom';
|
|
3403
|
+
}
|
|
3404
|
+
} }),
|
|
3405
|
+
],
|
|
3406
|
+
},
|
|
3407
|
+
},
|
|
3408
|
+
{
|
|
3409
|
+
urls: ['goatswap.xyz'],
|
|
3410
|
+
walletsForProvider: {
|
|
3411
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3412
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3413
|
+
return (0, findIconAndName_1.findIconAndNameByIcon)(() => {
|
|
3414
|
+
var _a;
|
|
3415
|
+
return (_a = Array.from(document.querySelectorAll('img[alt="Phantom icon"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3416
|
+
}, 'auto-search-text', wallet.name);
|
|
3417
|
+
} }),
|
|
3418
|
+
],
|
|
3419
|
+
},
|
|
3420
|
+
},
|
|
3421
|
+
{
|
|
3422
|
+
urls: ['projectlarix.com'],
|
|
3423
|
+
walletsForProvider: {
|
|
3424
|
+
[cross_inpage_provider_types_1.IInjectedProviderNames.solana]: [
|
|
3425
|
+
Object.assign(Object.assign({}, exports.basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3426
|
+
return (0, findIconAndName_1.findIconAndNameByIcon)(() => {
|
|
3427
|
+
var _a;
|
|
3428
|
+
return (_a = Array.from(document.querySelectorAll('img[src*="/img/pop_wallet_logo_phantom"]')).filter((e) => (0, utils_1.isVisible)(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3429
|
+
}, 'auto-search-text', wallet.name);
|
|
3430
|
+
} }),
|
|
3431
|
+
],
|
|
3432
|
+
},
|
|
3433
|
+
},
|
|
3198
3434
|
];
|
|
@@ -30,11 +30,11 @@ function findIconAndNameByName(containerElement, walletName, icon = 'auto-search
|
|
|
30
30
|
if (typeof icon === 'function') {
|
|
31
31
|
iconNode = icon(textNode);
|
|
32
32
|
}
|
|
33
|
-
else if (icon === 'auto-search-icon') {
|
|
33
|
+
else if (icon === 'auto-search-icon' || icon === 'auto-search-icon-first') {
|
|
34
34
|
let parent = textNode.parentElement;
|
|
35
35
|
let level = 0;
|
|
36
36
|
while (parent && parent !== (containerElement === null || containerElement === void 0 ? void 0 : containerElement.parentElement) && level++ < consts_1.MAX_LEVELS) {
|
|
37
|
-
const walletIcon = (0, imgUtils_1.findWalletIconByParent)(parent, constraints.icon);
|
|
37
|
+
const walletIcon = (0, imgUtils_1.findWalletIconByParent)(parent, constraints.icon, icon === 'auto-search-icon-first' ? 0 : undefined);
|
|
38
38
|
if (!walletIcon) {
|
|
39
39
|
parent = parent.parentElement;
|
|
40
40
|
continue;
|
|
@@ -56,7 +56,7 @@ function findIconNodesByParent(parent) {
|
|
|
56
56
|
* @description:
|
|
57
57
|
* make sure that there is only one icon node match walletIcon to ignore hidden icon and other icon
|
|
58
58
|
*/
|
|
59
|
-
function findWalletIconByParent(parent, constraints) {
|
|
59
|
+
function findWalletIconByParent(parent, constraints, selectIconIndex) {
|
|
60
60
|
const iconNodes = findIconNodesByParent(parent);
|
|
61
61
|
if (iconNodes.length === 0) {
|
|
62
62
|
utils_1.universalLog.warn(`no icon node found for parent`, parent);
|
|
@@ -66,6 +66,9 @@ function findWalletIconByParent(parent, constraints) {
|
|
|
66
66
|
if (filteredIconNodes.length === 0) {
|
|
67
67
|
throw new Error('it doesnt satisfy the constraints');
|
|
68
68
|
}
|
|
69
|
+
if (selectIconIndex != null) {
|
|
70
|
+
return filteredIconNodes[selectIconIndex];
|
|
71
|
+
}
|
|
69
72
|
if (filteredIconNodes.length > 1) {
|
|
70
73
|
utils_1.universalLog.warn(`more than one icon node found`, iconNodes.length, iconNodes);
|
|
71
74
|
throw new Error('more than one icon node found');
|
|
@@ -113,12 +113,13 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
113
113
|
// Override MetaMask EIP6963 Provider
|
|
114
114
|
if ((0, cross_inpage_provider_core_1.checkWalletSwitchEnable)()) {
|
|
115
115
|
(0, onekey_eth_provider_1.registerEIP6963Provider)({
|
|
116
|
-
uuid: '7677b54f-3486-46e2-4e37-
|
|
116
|
+
uuid: '7677b54f-3486-46e2-4e37-bf8747814f12',
|
|
117
117
|
name: 'MetaMask',
|
|
118
118
|
rdns: 'io.metamask',
|
|
119
119
|
image: consts_1.WALLET_CONNECT_INFO.metamask.icon,
|
|
120
120
|
provider: ethereum,
|
|
121
121
|
});
|
|
122
|
+
(0, cross_inpage_provider_core_1.defineWindowProperty)('mmsdk', new onekey_eth_provider_1.MetaMaskSDK(ethereum));
|
|
122
123
|
}
|
|
123
124
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('solana', solana);
|
|
124
125
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('phantom', { solana, ethereum });
|
|
@@ -146,6 +147,7 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
146
147
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('algorand', algorand);
|
|
147
148
|
(0, cross_inpage_provider_core_1.defineWindowProperty)('exodus', {
|
|
148
149
|
algorand,
|
|
150
|
+
ethereum
|
|
149
151
|
});
|
|
150
152
|
// Cardano chain provider injection is handled independently.
|
|
151
153
|
if ((0, cross_inpage_provider_core_1.checkWalletSwitchEnable)()) {
|
|
@@ -194,9 +196,9 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
194
196
|
if ((0, cross_inpage_provider_core_1.checkWalletSwitchEnable)()) {
|
|
195
197
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
196
198
|
(0, onekey_aptos_provider_1.registerAptosWallet)(martian, {
|
|
197
|
-
name: '
|
|
198
|
-
logo: consts_1.WALLET_CONNECT_INFO.
|
|
199
|
-
url: 'https://
|
|
199
|
+
name: 'Petra',
|
|
200
|
+
logo: consts_1.WALLET_CONNECT_INFO.petra.icon,
|
|
201
|
+
url: 'https://chromewebstore.google.com/detail/petra-aptos-wallet/ejjladinnckdgjemekebdpeokbikhfci',
|
|
200
202
|
});
|
|
201
203
|
}
|
|
202
204
|
if ((0, cross_inpage_provider_core_1.checkWalletSwitchEnable)()) {
|
|
@@ -1929,10 +1929,16 @@ export const sitesConfig = [
|
|
|
1929
1929
|
testPath: [':text("CONNECT WALLET")'],
|
|
1930
1930
|
walletsForProvider: {
|
|
1931
1931
|
[IInjectedProviderNames.ethereum]: [
|
|
1932
|
-
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: () => getConnectWalletModalByTitle('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1932
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: () => getConnectWalletModalByTitle('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1933
|
+
'Connect Wallet',
|
|
1934
|
+
'Wallet Overview',
|
|
1935
|
+
]) }),
|
|
1933
1936
|
],
|
|
1934
1937
|
[IInjectedProviderNames.solana]: [
|
|
1935
|
-
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { container: () => getConnectWalletModalByTitle('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1938
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { container: () => getConnectWalletModalByTitle('#headlessui-portal-root div[id*="headlessui-dialog-"]', [
|
|
1939
|
+
'Connect Wallet',
|
|
1940
|
+
'Wallet Overview',
|
|
1941
|
+
]) }),
|
|
1936
1942
|
],
|
|
1937
1943
|
},
|
|
1938
1944
|
},
|
|
@@ -2912,7 +2918,8 @@ export const sitesConfig = [
|
|
|
2912
2918
|
[IInjectedProviderNames.ethereum]: [
|
|
2913
2919
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
2914
2920
|
const modal = document.querySelector('div[role="dialog"].fixed.inset-0');
|
|
2915
|
-
return modal &&
|
|
2921
|
+
return (modal &&
|
|
2922
|
+
findIconAndNameByIcon('img[alt="MetaMask"]', 'auto-search-text', name, modal));
|
|
2916
2923
|
} }),
|
|
2917
2924
|
],
|
|
2918
2925
|
},
|
|
@@ -2924,13 +2931,14 @@ export const sitesConfig = [
|
|
|
2924
2931
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'div[role="dialog"]', findIconAndName({ name }) {
|
|
2925
2932
|
var _a;
|
|
2926
2933
|
const modal = getConnectWalletModalByTitle('div[role="dialog"]', 'Connect your wallet');
|
|
2927
|
-
return (_a = (modal &&
|
|
2928
|
-
icon
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
+
return ((_a = (modal &&
|
|
2935
|
+
findIconAndNameByName(modal, name, 'auto-search-icon', {
|
|
2936
|
+
icon: [
|
|
2937
|
+
isWalletIconLessEqualThan,
|
|
2938
|
+
(icon) => icon.getAttribute('aria-hidden') !== 'true',
|
|
2939
|
+
],
|
|
2940
|
+
text: [],
|
|
2941
|
+
}))) !== null && _a !== void 0 ? _a : null);
|
|
2934
2942
|
} }),
|
|
2935
2943
|
],
|
|
2936
2944
|
},
|
|
@@ -2972,7 +2980,8 @@ export const sitesConfig = [
|
|
|
2972
2980
|
[IInjectedProviderNames.btc]: [
|
|
2973
2981
|
Object.assign(Object.assign({}, basicWalletInfo['unisat']), { findIconAndName({ name }) {
|
|
2974
2982
|
const modal = getConnectWalletModalByTitle('div.dropdown.dropdown-end', 'Connect Wallet');
|
|
2975
|
-
return modal &&
|
|
2983
|
+
return (modal &&
|
|
2984
|
+
findIconAndNameByIcon('img[alt="Unisat Wallet"]', 'auto-search-text', name, modal));
|
|
2976
2985
|
},
|
|
2977
2986
|
afterUpdate(textNode, iconNode) {
|
|
2978
2987
|
if (textNode) {
|
|
@@ -3002,12 +3011,10 @@ export const sitesConfig = [
|
|
|
3002
3011
|
[IInjectedProviderNames.ethereum]: [
|
|
3003
3012
|
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3004
3013
|
var _a;
|
|
3005
|
-
return (_a = findIconAndNameByName(document.body, name, 'auto-search-icon', {
|
|
3006
|
-
icon: [
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
text: []
|
|
3010
|
-
})) !== null && _a !== void 0 ? _a : null;
|
|
3014
|
+
return ((_a = findIconAndNameByName(document.body, name, 'auto-search-icon', {
|
|
3015
|
+
icon: [(icon) => icon.classList.contains('chakra-icon')],
|
|
3016
|
+
text: [],
|
|
3017
|
+
})) !== null && _a !== void 0 ? _a : null);
|
|
3011
3018
|
} }),
|
|
3012
3019
|
],
|
|
3013
3020
|
},
|
|
@@ -3077,7 +3084,7 @@ export const sitesConfig = [
|
|
|
3077
3084
|
urls: ['app.streamflow.finance'],
|
|
3078
3085
|
walletsForProvider: {
|
|
3079
3086
|
[IInjectedProviderNames.sui]: [
|
|
3080
|
-
Object.assign(Object.assign({}, basicWalletInfo['suiwallet']), { container:
|
|
3087
|
+
Object.assign(Object.assign({}, basicWalletInfo['suiwallet']), { container: 'div.w-full.sm\\:w-100' }),
|
|
3081
3088
|
],
|
|
3082
3089
|
},
|
|
3083
3090
|
},
|
|
@@ -3087,7 +3094,8 @@ export const sitesConfig = [
|
|
|
3087
3094
|
[IInjectedProviderNames.sui]: [
|
|
3088
3095
|
Object.assign(Object.assign({}, basicWalletInfo['suiwallet']), { findIconAndName({ name }) {
|
|
3089
3096
|
const modal = getConnectWalletModalByTitle('div[role="dialog"]', 'Connect a Wallet from list');
|
|
3090
|
-
return modal &&
|
|
3097
|
+
return (modal &&
|
|
3098
|
+
findIconAndNameByIcon('img[alt="Sui Wallet"]', 'auto-search-text', name, modal));
|
|
3091
3099
|
} }),
|
|
3092
3100
|
],
|
|
3093
3101
|
},
|
|
@@ -3189,4 +3197,232 @@ export const sitesConfig = [
|
|
|
3189
3197
|
],
|
|
3190
3198
|
},
|
|
3191
3199
|
},
|
|
3200
|
+
{
|
|
3201
|
+
urls: ['app.squidrouter.com'],
|
|
3202
|
+
walletsForProvider: {
|
|
3203
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3204
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3205
|
+
var _a, _b;
|
|
3206
|
+
return ((_b = findIconAndNameByName((_a = document.querySelector('aside section ul')) !== null && _a !== void 0 ? _a : document.body, name, 'auto-search-icon-first')) !== null && _b !== void 0 ? _b : null);
|
|
3207
|
+
} }),
|
|
3208
|
+
],
|
|
3209
|
+
[IInjectedProviderNames.btc]: [
|
|
3210
|
+
Object.assign(Object.assign({}, basicWalletInfo['unisat']), { findIconAndName({ name }) {
|
|
3211
|
+
var _a, _b;
|
|
3212
|
+
return ((_b = findIconAndNameByName((_a = document.querySelector('aside section ul')) !== null && _a !== void 0 ? _a : document.body, name, 'auto-search-icon-first')) !== null && _b !== void 0 ? _b : null);
|
|
3213
|
+
} }),
|
|
3214
|
+
],
|
|
3215
|
+
[IInjectedProviderNames.solana]: [
|
|
3216
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3217
|
+
var _a, _b;
|
|
3218
|
+
return ((_b = findIconAndNameByName((_a = document.querySelector('aside section ul')) !== null && _a !== void 0 ? _a : document.body, name, 'auto-search-icon-first')) !== null && _b !== void 0 ? _b : null);
|
|
3219
|
+
} }),
|
|
3220
|
+
],
|
|
3221
|
+
},
|
|
3222
|
+
},
|
|
3223
|
+
{
|
|
3224
|
+
urls: ['portal.bouncebit.io'],
|
|
3225
|
+
walletsForProvider: {
|
|
3226
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3227
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName(wallet) {
|
|
3228
|
+
return findIconAndNameByIcon(() => {
|
|
3229
|
+
var _a;
|
|
3230
|
+
return (_a = Array.from(document.querySelectorAll('img[src*="/images/wallet/metamask.png"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3231
|
+
}, 'auto-search-text', wallet.name);
|
|
3232
|
+
} }),
|
|
3233
|
+
],
|
|
3234
|
+
},
|
|
3235
|
+
},
|
|
3236
|
+
{
|
|
3237
|
+
urls: ['obelisk.nodedao.com'],
|
|
3238
|
+
walletsForProvider: {
|
|
3239
|
+
[IInjectedProviderNames.btc]: [
|
|
3240
|
+
Object.assign(Object.assign({}, basicWalletInfo['unisat']), { findIconAndName({ name }) {
|
|
3241
|
+
var _a;
|
|
3242
|
+
return (_a = findIconAndNameByName(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3243
|
+
} }),
|
|
3244
|
+
],
|
|
3245
|
+
},
|
|
3246
|
+
},
|
|
3247
|
+
{
|
|
3248
|
+
urls: ['dapp.tokenbridge.rootstock.io', 'hive.bsquared.network', 'portal.bouncebit.io', 'www.lolik.com'],
|
|
3249
|
+
walletsForProvider: {
|
|
3250
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3251
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3252
|
+
var _a;
|
|
3253
|
+
return (_a = findIconAndNameByName(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3254
|
+
} }),
|
|
3255
|
+
],
|
|
3256
|
+
},
|
|
3257
|
+
},
|
|
3258
|
+
{
|
|
3259
|
+
urls: ['bridge.metis.io'],
|
|
3260
|
+
walletsForProvider: {
|
|
3261
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3262
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3263
|
+
var _a;
|
|
3264
|
+
const modal = getConnectWalletModalByTitle('div.sc-iGgWBj.jEkttQ', 'Connect your wallet');
|
|
3265
|
+
return (_a = (modal && findIconAndNameByName(modal, /.*meta\s*mask$/i, 'auto-search-icon'))) !== null && _a !== void 0 ? _a : null;
|
|
3266
|
+
} }),
|
|
3267
|
+
],
|
|
3268
|
+
},
|
|
3269
|
+
},
|
|
3270
|
+
{
|
|
3271
|
+
urls: ['lista.org'],
|
|
3272
|
+
walletsForProvider: {
|
|
3273
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3274
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3275
|
+
var _a, _b;
|
|
3276
|
+
const modal = document.querySelector('div[role="alertdialog"]');
|
|
3277
|
+
const text = modal && findWalletTextByParent(modal, name, []);
|
|
3278
|
+
const icon = (_b = (_a = text === null || text === void 0 ? void 0 : text.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.querySelector('img');
|
|
3279
|
+
return (text && {
|
|
3280
|
+
textNode: text,
|
|
3281
|
+
iconNode: icon !== null && icon !== void 0 ? icon : null,
|
|
3282
|
+
});
|
|
3283
|
+
} }),
|
|
3284
|
+
],
|
|
3285
|
+
},
|
|
3286
|
+
},
|
|
3287
|
+
{
|
|
3288
|
+
urls: ['app.coffer.network'],
|
|
3289
|
+
walletsForProvider: {
|
|
3290
|
+
[IInjectedProviderNames.btc]: [
|
|
3291
|
+
Object.assign(Object.assign({}, basicWalletInfo['unisat']), { container: () => getConnectWalletModalByTitle('div.ant-web3-connect-modal-body.css-ccdg5a', 'Connect Wallet') }),
|
|
3292
|
+
],
|
|
3293
|
+
},
|
|
3294
|
+
},
|
|
3295
|
+
{
|
|
3296
|
+
urls: ['www.stakedao.org'],
|
|
3297
|
+
walletsForProvider: {
|
|
3298
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3299
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName(wallet) {
|
|
3300
|
+
var _a;
|
|
3301
|
+
const iconNode = (_a = Array.from(document.querySelectorAll('img[alt="metamask wallet logo"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3302
|
+
// 创建一个空的文本节点
|
|
3303
|
+
return iconNode ? {
|
|
3304
|
+
textNode: document.createTextNode(''),
|
|
3305
|
+
iconNode: iconNode
|
|
3306
|
+
} : null;
|
|
3307
|
+
} }),
|
|
3308
|
+
],
|
|
3309
|
+
},
|
|
3310
|
+
},
|
|
3311
|
+
{
|
|
3312
|
+
urls: ['www.babylon.magpiexyz.io', 'homora-v2.alphaventuredao.io', 'app.yei.finance', 'portal.bouncebit.io'],
|
|
3313
|
+
walletsForProvider: {
|
|
3314
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3315
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3316
|
+
var _a;
|
|
3317
|
+
return (_a = findIconAndNameByName(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3318
|
+
} }),
|
|
3319
|
+
],
|
|
3320
|
+
},
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
urls: ['exsat.network'],
|
|
3324
|
+
mutationObserverOptions: {
|
|
3325
|
+
childList: true,
|
|
3326
|
+
subtree: true,
|
|
3327
|
+
attributes: true,
|
|
3328
|
+
},
|
|
3329
|
+
constraintMap: {
|
|
3330
|
+
icon: [isWalletIconLessEqualThan],
|
|
3331
|
+
text: [],
|
|
3332
|
+
},
|
|
3333
|
+
walletsForProvider: {
|
|
3334
|
+
[IInjectedProviderNames.ethereum]: [
|
|
3335
|
+
Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
|
|
3336
|
+
var _a;
|
|
3337
|
+
const modal = document.querySelector('.ant-modal-body');
|
|
3338
|
+
return (_a = (modal && findIconAndNameByName(modal, name, 'auto-search-icon', {
|
|
3339
|
+
icon: [isWalletIconLessEqualThan],
|
|
3340
|
+
text: []
|
|
3341
|
+
}))) !== null && _a !== void 0 ? _a : null;
|
|
3342
|
+
} }),
|
|
3343
|
+
],
|
|
3344
|
+
},
|
|
3345
|
+
},
|
|
3346
|
+
{
|
|
3347
|
+
urls: ['app.pluto.so'],
|
|
3348
|
+
walletsForProvider: {
|
|
3349
|
+
[IInjectedProviderNames.solana]: [
|
|
3350
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3351
|
+
return findIconAndNameByIcon(() => {
|
|
3352
|
+
var _a;
|
|
3353
|
+
return (_a = Array.from(document.querySelectorAll('img[alt="phantom wallet"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3354
|
+
}, 'auto-search-text', wallet.name);
|
|
3355
|
+
} }),
|
|
3356
|
+
],
|
|
3357
|
+
},
|
|
3358
|
+
},
|
|
3359
|
+
{
|
|
3360
|
+
urls: ['app.cega.fi', 'parrot.fi', 'app.rate-x.io', 'app.meteora.ag', 'app.fragmetric.xyz', 'app.apricot.one',
|
|
3361
|
+
'dex.saros.xyz', 'tulip.garden'],
|
|
3362
|
+
walletsForProvider: {
|
|
3363
|
+
[IInjectedProviderNames.solana]: [
|
|
3364
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3365
|
+
var _a;
|
|
3366
|
+
return (_a = findIconAndNameByName(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3367
|
+
} }),
|
|
3368
|
+
],
|
|
3369
|
+
},
|
|
3370
|
+
},
|
|
3371
|
+
{
|
|
3372
|
+
urls: ['app.adrena.xyz'],
|
|
3373
|
+
walletsForProvider: {
|
|
3374
|
+
[IInjectedProviderNames.solana]: [
|
|
3375
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3376
|
+
const textNodes = domUtils.findTextNode(document.body, name, 'all');
|
|
3377
|
+
const textNode = textNodes === null || textNodes === void 0 ? void 0 : textNodes.find(node => node.parentElement && isVisible(node.parentElement));
|
|
3378
|
+
return (textNode === null || textNode === void 0 ? void 0 : textNode.parentElement) ? {
|
|
3379
|
+
textNode: textNode,
|
|
3380
|
+
iconNode: textNode.parentElement
|
|
3381
|
+
} : null;
|
|
3382
|
+
} }),
|
|
3383
|
+
],
|
|
3384
|
+
},
|
|
3385
|
+
},
|
|
3386
|
+
{
|
|
3387
|
+
urls: ['swap.pump.fun'],
|
|
3388
|
+
walletsForProvider: {
|
|
3389
|
+
[IInjectedProviderNames.solana]: [
|
|
3390
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName({ name }) {
|
|
3391
|
+
var _a;
|
|
3392
|
+
return (_a = findIconAndNameByName(document.body, name, 'auto-search-icon')) !== null && _a !== void 0 ? _a : null;
|
|
3393
|
+
},
|
|
3394
|
+
afterUpdate(textNode) {
|
|
3395
|
+
if (textNode) {
|
|
3396
|
+
textNode.textContent = 'Onekey&Phantom';
|
|
3397
|
+
}
|
|
3398
|
+
} }),
|
|
3399
|
+
],
|
|
3400
|
+
},
|
|
3401
|
+
},
|
|
3402
|
+
{
|
|
3403
|
+
urls: ['goatswap.xyz'],
|
|
3404
|
+
walletsForProvider: {
|
|
3405
|
+
[IInjectedProviderNames.solana]: [
|
|
3406
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3407
|
+
return findIconAndNameByIcon(() => {
|
|
3408
|
+
var _a;
|
|
3409
|
+
return (_a = Array.from(document.querySelectorAll('img[alt="Phantom icon"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3410
|
+
}, 'auto-search-text', wallet.name);
|
|
3411
|
+
} }),
|
|
3412
|
+
],
|
|
3413
|
+
},
|
|
3414
|
+
},
|
|
3415
|
+
{
|
|
3416
|
+
urls: ['projectlarix.com'],
|
|
3417
|
+
walletsForProvider: {
|
|
3418
|
+
[IInjectedProviderNames.solana]: [
|
|
3419
|
+
Object.assign(Object.assign({}, basicWalletInfo['phantom']), { findIconAndName(wallet) {
|
|
3420
|
+
return findIconAndNameByIcon(() => {
|
|
3421
|
+
var _a;
|
|
3422
|
+
return (_a = Array.from(document.querySelectorAll('img[src*="/img/pop_wallet_logo_phantom"]')).filter((e) => isVisible(e))) === null || _a === void 0 ? void 0 : _a[0];
|
|
3423
|
+
}, 'auto-search-text', wallet.name);
|
|
3424
|
+
} }),
|
|
3425
|
+
],
|
|
3426
|
+
},
|
|
3427
|
+
},
|
|
3192
3428
|
];
|
|
@@ -5,7 +5,7 @@ import { ConstraintFn, FindResultType, Selector } from './type';
|
|
|
5
5
|
* don't document to querySelector because it maybe not work in shadowRoot,
|
|
6
6
|
* instead of it, use the containerElement
|
|
7
7
|
*/
|
|
8
|
-
export declare function findIconAndNameByName(containerElement: HTMLElement, walletName: RegExp, icon?: 'none' | 'auto-search-icon' | ((text: Text) => HTMLElement | null | undefined), constraints?: {
|
|
8
|
+
export declare function findIconAndNameByName(containerElement: HTMLElement, walletName: RegExp, icon?: 'none' | 'auto-search-icon' | 'auto-search-icon-first' | ((text: Text) => HTMLElement | null | undefined), constraints?: {
|
|
9
9
|
text: ConstraintFn[];
|
|
10
10
|
icon: ConstraintFn[];
|
|
11
11
|
}): FindResultType | null;
|
|
@@ -25,11 +25,11 @@ export function findIconAndNameByName(containerElement, walletName, icon = 'auto
|
|
|
25
25
|
if (typeof icon === 'function') {
|
|
26
26
|
iconNode = icon(textNode);
|
|
27
27
|
}
|
|
28
|
-
else if (icon === 'auto-search-icon') {
|
|
28
|
+
else if (icon === 'auto-search-icon' || icon === 'auto-search-icon-first') {
|
|
29
29
|
let parent = textNode.parentElement;
|
|
30
30
|
let level = 0;
|
|
31
31
|
while (parent && parent !== (containerElement === null || containerElement === void 0 ? void 0 : containerElement.parentElement) && level++ < MAX_LEVELS) {
|
|
32
|
-
const walletIcon = findWalletIconByParent(parent, constraints.icon);
|
|
32
|
+
const walletIcon = findWalletIconByParent(parent, constraints.icon, icon === 'auto-search-icon-first' ? 0 : undefined);
|
|
33
33
|
if (!walletIcon) {
|
|
34
34
|
parent = parent.parentElement;
|
|
35
35
|
continue;
|
|
@@ -9,6 +9,6 @@ export declare function findIconNodesByParent(parent: HTMLElement): HTMLElement[
|
|
|
9
9
|
* @description:
|
|
10
10
|
* make sure that there is only one icon node match walletIcon to ignore hidden icon and other icon
|
|
11
11
|
*/
|
|
12
|
-
export declare function findWalletIconByParent(parent: HTMLElement, constraints: ConstraintFn[]): HTMLElement | null;
|
|
12
|
+
export declare function findWalletIconByParent(parent: HTMLElement, constraints: ConstraintFn[], selectIconIndex?: number): HTMLElement | null;
|
|
13
13
|
export declare function isWalletIconSizeMatch(walletIcon: HTMLElement, min?: number, max?: number): boolean;
|
|
14
14
|
export declare function isWalletIconLessEqualThan(walletIcon: HTMLElement): boolean;
|
|
@@ -48,7 +48,7 @@ export function findIconNodesByParent(parent) {
|
|
|
48
48
|
* @description:
|
|
49
49
|
* make sure that there is only one icon node match walletIcon to ignore hidden icon and other icon
|
|
50
50
|
*/
|
|
51
|
-
export function findWalletIconByParent(parent, constraints) {
|
|
51
|
+
export function findWalletIconByParent(parent, constraints, selectIconIndex) {
|
|
52
52
|
const iconNodes = findIconNodesByParent(parent);
|
|
53
53
|
if (iconNodes.length === 0) {
|
|
54
54
|
universalLog.warn(`no icon node found for parent`, parent);
|
|
@@ -58,6 +58,9 @@ export function findWalletIconByParent(parent, constraints) {
|
|
|
58
58
|
if (filteredIconNodes.length === 0) {
|
|
59
59
|
throw new Error('it doesnt satisfy the constraints');
|
|
60
60
|
}
|
|
61
|
+
if (selectIconIndex != null) {
|
|
62
|
+
return filteredIconNodes[selectIconIndex];
|
|
63
|
+
}
|
|
61
64
|
if (filteredIconNodes.length > 1) {
|
|
62
65
|
universalLog.warn(`more than one icon node found`, iconNodes.length, iconNodes);
|
|
63
66
|
throw new Error('more than one icon node found');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderEthereum, shimWeb3, registerEIP6963Provider } from '@onekeyfe/onekey-eth-provider';
|
|
1
|
+
import { ProviderEthereum, shimWeb3, registerEIP6963Provider, MetaMaskSDK, } from '@onekeyfe/onekey-eth-provider';
|
|
2
2
|
import { ProviderPrivate } from '@onekeyfe/onekey-private-provider';
|
|
3
3
|
import { ProviderSolana, registerSolanaWallet } from '@onekeyfe/onekey-solana-provider';
|
|
4
4
|
import { ProviderAptosMartian, registerAptosWallet, } from '@onekeyfe/onekey-aptos-provider';
|
|
@@ -110,12 +110,13 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
110
110
|
// Override MetaMask EIP6963 Provider
|
|
111
111
|
if (checkWalletSwitchEnable()) {
|
|
112
112
|
registerEIP6963Provider({
|
|
113
|
-
uuid: '7677b54f-3486-46e2-4e37-
|
|
113
|
+
uuid: '7677b54f-3486-46e2-4e37-bf8747814f12',
|
|
114
114
|
name: 'MetaMask',
|
|
115
115
|
rdns: 'io.metamask',
|
|
116
116
|
image: WALLET_CONNECT_INFO.metamask.icon,
|
|
117
117
|
provider: ethereum,
|
|
118
118
|
});
|
|
119
|
+
defineWindowProperty('mmsdk', new MetaMaskSDK(ethereum));
|
|
119
120
|
}
|
|
120
121
|
defineWindowProperty('solana', solana);
|
|
121
122
|
defineWindowProperty('phantom', { solana, ethereum });
|
|
@@ -143,6 +144,7 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
143
144
|
defineWindowProperty('algorand', algorand);
|
|
144
145
|
defineWindowProperty('exodus', {
|
|
145
146
|
algorand,
|
|
147
|
+
ethereum
|
|
146
148
|
});
|
|
147
149
|
// Cardano chain provider injection is handled independently.
|
|
148
150
|
if (checkWalletSwitchEnable()) {
|
|
@@ -191,9 +193,9 @@ function injectWeb3Provider({ showFloatingButton = false, } = {}) {
|
|
|
191
193
|
if (checkWalletSwitchEnable()) {
|
|
192
194
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
193
195
|
registerAptosWallet(martian, {
|
|
194
|
-
name: '
|
|
195
|
-
logo: WALLET_CONNECT_INFO.
|
|
196
|
-
url: 'https://
|
|
196
|
+
name: 'Petra',
|
|
197
|
+
logo: WALLET_CONNECT_INFO.petra.icon,
|
|
198
|
+
url: 'https://chromewebstore.google.com/detail/petra-aptos-wallet/ejjladinnckdgjemekebdpeokbikhfci',
|
|
197
199
|
});
|
|
198
200
|
}
|
|
199
201
|
if (checkWalletSwitchEnable()) {
|
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.23",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -28,27 +28,27 @@
|
|
|
28
28
|
"start": "tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-core": "2.2.
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-types": "2.2.
|
|
33
|
-
"@onekeyfe/onekey-algo-provider": "2.2.
|
|
34
|
-
"@onekeyfe/onekey-alph-provider": "2.2.
|
|
35
|
-
"@onekeyfe/onekey-aptos-provider": "2.2.
|
|
36
|
-
"@onekeyfe/onekey-bfc-provider": "2.2.
|
|
37
|
-
"@onekeyfe/onekey-btc-provider": "2.2.
|
|
38
|
-
"@onekeyfe/onekey-cardano-provider": "2.2.
|
|
39
|
-
"@onekeyfe/onekey-conflux-provider": "2.2.
|
|
40
|
-
"@onekeyfe/onekey-cosmos-provider": "2.2.
|
|
41
|
-
"@onekeyfe/onekey-eth-provider": "2.2.
|
|
42
|
-
"@onekeyfe/onekey-neo-provider": "2.2.
|
|
43
|
-
"@onekeyfe/onekey-nostr-provider": "2.2.
|
|
44
|
-
"@onekeyfe/onekey-polkadot-provider": "2.2.
|
|
45
|
-
"@onekeyfe/onekey-private-provider": "2.2.
|
|
46
|
-
"@onekeyfe/onekey-scdo-provider": "2.2.
|
|
47
|
-
"@onekeyfe/onekey-solana-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.
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-core": "2.2.23",
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-types": "2.2.23",
|
|
33
|
+
"@onekeyfe/onekey-algo-provider": "2.2.23",
|
|
34
|
+
"@onekeyfe/onekey-alph-provider": "2.2.23",
|
|
35
|
+
"@onekeyfe/onekey-aptos-provider": "2.2.23",
|
|
36
|
+
"@onekeyfe/onekey-bfc-provider": "2.2.23",
|
|
37
|
+
"@onekeyfe/onekey-btc-provider": "2.2.23",
|
|
38
|
+
"@onekeyfe/onekey-cardano-provider": "2.2.23",
|
|
39
|
+
"@onekeyfe/onekey-conflux-provider": "2.2.23",
|
|
40
|
+
"@onekeyfe/onekey-cosmos-provider": "2.2.23",
|
|
41
|
+
"@onekeyfe/onekey-eth-provider": "2.2.23",
|
|
42
|
+
"@onekeyfe/onekey-neo-provider": "2.2.23",
|
|
43
|
+
"@onekeyfe/onekey-nostr-provider": "2.2.23",
|
|
44
|
+
"@onekeyfe/onekey-polkadot-provider": "2.2.23",
|
|
45
|
+
"@onekeyfe/onekey-private-provider": "2.2.23",
|
|
46
|
+
"@onekeyfe/onekey-scdo-provider": "2.2.23",
|
|
47
|
+
"@onekeyfe/onekey-solana-provider": "2.2.23",
|
|
48
|
+
"@onekeyfe/onekey-sui-provider": "2.2.23",
|
|
49
|
+
"@onekeyfe/onekey-ton-provider": "2.2.23",
|
|
50
|
+
"@onekeyfe/onekey-tron-provider": "2.2.23",
|
|
51
|
+
"@onekeyfe/onekey-webln-provider": "2.2.23",
|
|
52
52
|
"lodash-es": "^4.17.21",
|
|
53
53
|
"preact": "^10.25.1",
|
|
54
54
|
"web3": "^1.7.3"
|
|
@@ -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": "3754c167ab566db6a3b93ca8e46f8fc79afc6009"
|
|
61
61
|
}
|