@onekeyfe/inpage-providers-hub 2.0.0-alpha.7 → 2.0.0-alpha.8

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.
@@ -46,7 +46,7 @@ exports.basicWalletInfo = {
46
46
  [consts_1.WALLET_NAMES.petra]: {
47
47
  updatedIcon: consts_1.WALLET_CONNECT_INFO.petra.icon,
48
48
  updatedName: consts_1.WALLET_CONNECT_INFO.petra.text,
49
- name: /^Petra$/i,
49
+ name: /^(Petra|Petra Wallet)$/i,
50
50
  },
51
51
  [consts_1.WALLET_NAMES.keplr]: {
52
52
  updatedIcon: consts_1.WALLET_CONNECT_INFO.keplr.icon,
@@ -1416,22 +1416,42 @@ exports.sitesConfig = [
1416
1416
  },
1417
1417
  },
1418
1418
  {
1419
+ //mobile version is redirected to app-mobile.ariesmarkets.xyz. check next item
1419
1420
  urls: ['app.ariesmarkets.xyz'],
1420
1421
  testUrls: ['app.ariesmarkets.xyz/lending'],
1421
- // mutationObserverOptions: {
1422
- // childList: true,
1423
- // subtree: true,
1424
- // attributes: true,
1425
- // },
1426
- //TODO: mobile version
1427
1422
  constraintMap: { icon: [imgUtils_1.isWalletIconSizeMatch], text: [] },
1428
1423
  walletsForProvider: {
1429
1424
  [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');
1425
+ Object.assign(Object.assign({}, exports.basicWalletInfo['petra']), { container: () => (0, utils_1.getConnectWalletModalByTitle)('div.mantine-Paper-root', 'Select Wallet') }),
1426
+ ],
1427
+ },
1428
+ },
1429
+ {
1430
+ urls: ['app-mobile.ariesmarkets.xyz'],
1431
+ constraintMap: { icon: [imgUtils_1.isWalletIconSizeMatch], text: [] },
1432
+ walletsForProvider: {
1433
+ [cross_inpage_provider_types_1.IInjectedProviderNames.aptos]: [
1434
+ Object.assign(Object.assign({}, exports.basicWalletInfo['petra']), { findIconAndName({ name }) {
1435
+ var _a, _b, _c, _d, _e, _f;
1433
1436
  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);
1437
+ const modal = ((_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;
1438
+ if (!modal) {
1439
+ return null;
1440
+ }
1441
+ //there is multiple wallet icons, so we need to find the correct one manually
1442
+ const text = utilsDomNodes_1.default.findTextNode(modal, name, 'first');
1443
+ const imgs = Array.from(((_f = (_e = (_d = text.parentElement) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.parentElement) === null || _f === void 0 ? void 0 : _f.querySelectorAll('div[style*="background-image"]')) || []);
1444
+ if (imgs.length > 1 || imgs.length === 0) {
1445
+ return null;
1446
+ }
1447
+ const img = imgs[0];
1448
+ if (!text || !img) {
1449
+ return null;
1450
+ }
1451
+ return {
1452
+ iconNode: img,
1453
+ textNode: text,
1454
+ };
1435
1455
  } }),
1436
1456
  ],
1437
1457
  },
@@ -1497,4 +1517,197 @@ exports.sitesConfig = [
1497
1517
  ],
1498
1518
  },
1499
1519
  },
1520
+ {
1521
+ urls: ['agni.finance'],
1522
+ walletsForProvider: {
1523
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1524
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1525
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('div.inside', 'Connect Wallet') ||
1526
+ (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Start by connecting with one');
1527
+ return (modal &&
1528
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="metamask.png"]', 'auto-search-text', name, modal));
1529
+ } }),
1530
+ ],
1531
+ },
1532
+ },
1533
+ {
1534
+ urls: ['liquidswap.com'],
1535
+ testPath: [
1536
+ ':text("I accept the")',
1537
+ ':text("Continue")',
1538
+ ':text("Connect Wallet")',
1539
+ ':text("Other Wallets")',
1540
+ ],
1541
+ walletsForProvider: {
1542
+ [cross_inpage_provider_types_1.IInjectedProviderNames.aptos]: [
1543
+ Object.assign(Object.assign({}, exports.basicWalletInfo['petra']), { findIconAndName({ name }) {
1544
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('div.p-dialog', 'Connect a Wallet');
1545
+ return (modal &&
1546
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[alt="Petra Wallet"]', 'auto-search-text', name, modal));
1547
+ } }),
1548
+ ],
1549
+ },
1550
+ },
1551
+ // {
1552
+ // urls: ['stbt.matrixdock.com'],
1553
+ // walletsForProvider: {
1554
+ // [IInjectedProviderNames.ethereum]: [
1555
+ // {
1556
+ // ...basicWalletInfo['metamask'],
1557
+ // findIconAndName({ name }) {
1558
+ // const modal = getConnectWalletModalByTitle('div.inside', 'Connect Wallet');
1559
+ // return (
1560
+ // modal &&
1561
+ // findIconAndNameDirectly('img[src*="metamask.png"]', 'auto-search-text', name, modal)
1562
+ // );
1563
+ // },
1564
+ // },
1565
+ // ],
1566
+ // },
1567
+ // },
1568
+ {
1569
+ urls: ['spooky.fi'],
1570
+ walletsForProvider: {
1571
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1572
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'div[data-testid="wallet-modal"]' }),
1573
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: 'div[data-testid="wallet-modal"]', skip: { mobile: true } }),
1574
+ ],
1575
+ },
1576
+ },
1577
+ {
1578
+ urls: ['usyc.hashnote.com'],
1579
+ testPath: [':text("Connect your wallet")'],
1580
+ walletsForProvider: {
1581
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1582
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1583
+ var _a;
1584
+ const shadowRoot = (_a = document.querySelector('div[data-testid="dynamic-modal-shadow"]')) === null || _a === void 0 ? void 0 : _a.shadowRoot;
1585
+ if (!shadowRoot) {
1586
+ return null;
1587
+ }
1588
+ const parent = shadowRoot.querySelector('div.wallet-list__container');
1589
+ return (parent &&
1590
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[data-testid="wallet-icon-metamask"]', 'auto-search-text', name, parent));
1591
+ } }),
1592
+ ],
1593
+ },
1594
+ },
1595
+ {
1596
+ urls: ['polygon.tangible.store'],
1597
+ testPath: {
1598
+ mobile: ['header button img'],
1599
+ desktop: [':text("Connect")'],
1600
+ },
1601
+ walletsForProvider: {
1602
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1603
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1604
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Connect wallet');
1605
+ return (modal &&
1606
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="metamask.svg"][alt="MetaMask icon"]', 'auto-search-text', name, modal));
1607
+ } }),
1608
+ ],
1609
+ },
1610
+ },
1611
+ {
1612
+ urls: ['apps.acala.network'],
1613
+ only: true,
1614
+ walletsForProvider: {
1615
+ [cross_inpage_provider_types_1.IInjectedProviderNames.polkadot]: [
1616
+ Object.assign(Object.assign({}, exports.basicWalletInfo['polkadot']), { findIconAndName() {
1617
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Connect Wallet');
1618
+ return (modal &&
1619
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[alt="Polkadotjs Logo"]', 'auto-search-text', /^Polkadot/, modal));
1620
+ } }),
1621
+ ],
1622
+ },
1623
+ },
1624
+ {
1625
+ urls: ['app.rhino.fi'],
1626
+ testPath: [':text("Allow All")', ':text("connect wallet")'],
1627
+ constraintMap: { icon: [], text: [] },
1628
+ walletsForProvider: {
1629
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1630
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: '#metamask' }),
1631
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: '#walletConnect' }),
1632
+ ],
1633
+ },
1634
+ },
1635
+ {
1636
+ urls: ['app.zero.button.finance'],
1637
+ testPath: { mobile: ['header button svg', ':text("Connect")'], desktop: [':text("Connect")'] },
1638
+ walletsForProvider: {
1639
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1640
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'ul.bn-onboard-modal-select-wallets' }),
1641
+ ],
1642
+ },
1643
+ },
1644
+ {
1645
+ urls: ['blast.io'],
1646
+ testUrls: ['blast.io/zh-CN/bridge'],
1647
+ testPath: [':text("Jackpot deck")', ":text('连接钱包')"],
1648
+ walletsForProvider: {
1649
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1650
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'div[aria-label="选择要连接的钱包"]' }),
1651
+ ],
1652
+ },
1653
+ },
1654
+ {
1655
+ urls: ['app.ichi.org'],
1656
+ skip: true,
1657
+ walletsForProvider: {
1658
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1659
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'button[data-testid="rk-wallet-option-metaMask"]' }),
1660
+ Object.assign(Object.assign({}, exports.basicWalletInfo['walletconnect']), { container: 'button[data-testid="rk-wallet-option-walletConnect"]' }),
1661
+ ],
1662
+ },
1663
+ },
1664
+ {
1665
+ urls: ['klayswap.com'],
1666
+ walletsForProvider: {
1667
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1668
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'div.SelectWalletModal', afterUpdate(textNode, icon) {
1669
+ if (textNode.parentElement) {
1670
+ textNode.parentElement.style.flexShrink = '0';
1671
+ textNode.parentElement.style.width = '100%';
1672
+ }
1673
+ icon.style.height = 'auto';
1674
+ } }),
1675
+ ],
1676
+ },
1677
+ },
1678
+ {
1679
+ urls: ['dojo.trading'],
1680
+ walletsForProvider: {
1681
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1682
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { findIconAndName({ name }) {
1683
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Connect Wallet');
1684
+ return (modal &&
1685
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="metamask.svg"][alt="Metamask"]', 'auto-search-text', name, modal));
1686
+ },
1687
+ afterUpdate(textNode, icon) {
1688
+ icon.style.marginRight = '12px';
1689
+ } }),
1690
+ ],
1691
+ [cross_inpage_provider_types_1.IInjectedProviderNames.cosmos]: [
1692
+ Object.assign(Object.assign({}, exports.basicWalletInfo['keplr']), { findIconAndName({ name }) {
1693
+ const modal = (0, utils_1.getConnectWalletModalByTitle)('div[role="dialog"]', 'Connect Wallet');
1694
+ return (modal &&
1695
+ (0, findIconAndName_1.findIconAndNameDirectly)('img[src*="keplr.svg"][alt="Keplr"]', 'auto-search-text', name, modal));
1696
+ },
1697
+ afterUpdate(textNode, icon) {
1698
+ icon.style.marginRight = '12px';
1699
+ } }),
1700
+ ],
1701
+ },
1702
+ },
1703
+ {
1704
+ urls: ['gains.trade'],
1705
+ testUrls: ['gains.trade/trading#BTC-USD'],
1706
+ testPath: ['button:has-text("Agree")', ':text("Connect Wallet")'],
1707
+ walletsForProvider: {
1708
+ [cross_inpage_provider_types_1.IInjectedProviderNames.ethereum]: [
1709
+ Object.assign(Object.assign({}, exports.basicWalletInfo['metamask']), { container: 'button[data-testid="rk-wallet-option-metaMask"]' }),
1710
+ ],
1711
+ },
1712
+ },
1500
1713
  ];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
+ exports.MAX_SEARCH_LEVELS_By_IMG = 4;
6
6
  exports.DISTNACE_BETWEEN_ICON_AND_TEXT = 100;
7
7
  exports.ICON_MAX_SIZE = 150;
8
8
  exports.ICON_MIN_SIZE = 10;
@@ -17,11 +17,11 @@ function findIconAndNameByParent(containerElement, walletName, constraints = {
17
17
  }) {
18
18
  const textNode = (0, textUtils_1.findWalletTextByParent)(containerElement, walletName, constraints.text);
19
19
  if (!textNode || !textNode.parentElement) {
20
- utils_1.universalLog.log(`===>no wallet name ${walletName.toString()} text node found`);
20
+ utils_1.universalLog.log(`no wallet name ${walletName.toString()} text node found`);
21
21
  return null;
22
22
  }
23
23
  if ((0, utils_1.isInExternalLink)(textNode.parentElement, containerElement)) {
24
- utils_1.universalLog.log(`===>${walletName.toString()} is in external link`);
24
+ utils_1.universalLog.log(`${walletName.toString()} is in external link`);
25
25
  return null;
26
26
  }
27
27
  let parent = textNode.parentElement;
@@ -38,7 +38,7 @@ function findIconAndNameByParent(containerElement, walletName, constraints = {
38
38
  break;
39
39
  }
40
40
  if (!iconNode) {
41
- utils_1.universalLog.log(`===>no wallet ${walletName.toString()} icon node found`);
41
+ utils_1.universalLog.log(`no wallet ${walletName.toString()} icon node found`);
42
42
  return null;
43
43
  }
44
44
  // make sure the icon and text are both existed
@@ -102,7 +102,7 @@ function findTextByImg(img, walletName, containerLimit, constraints, maxLevel =
102
102
  }
103
103
  parent = parent.parentElement;
104
104
  }
105
- utils_1.universalLog.warn('can not find the text node by img', level);
105
+ utils_1.universalLog.warn('can not find the text node by img ', level);
106
106
  return null;
107
107
  }
108
108
  exports.findTextByImg = findTextByImg;
@@ -8,7 +8,7 @@ const utils_1 = require("./utils");
8
8
  */
9
9
  function replaceIcon(originalNode, newIconSrc) {
10
10
  const computedstyle = window.getComputedStyle(originalNode);
11
- utils_1.universalLog.log('===>ok: replace icon', originalNode);
11
+ utils_1.universalLog.log('ok: replace icon', originalNode);
12
12
  const width = parseFloat(computedstyle.width) ? computedstyle.width : 'auto';
13
13
  const height = parseFloat(computedstyle.height) ? computedstyle.height : 'auto';
14
14
  if (originalNode instanceof HTMLImageElement) {
@@ -60,11 +60,11 @@ exports.findIconNodesByParent = findIconNodesByParent;
60
60
  function findWalletIconByParent(parent, constraints) {
61
61
  const iconNodes = findIconNodesByParent(parent);
62
62
  if (iconNodes.length === 0) {
63
- utils_1.universalLog.warn(`===>no icon node found`, parent);
63
+ utils_1.universalLog.warn(`no icon node found`, parent);
64
64
  return null;
65
65
  }
66
66
  if (iconNodes.length > 1) {
67
- utils_1.universalLog.warn(`===>more than one icon node found`, iconNodes.length, iconNodes);
67
+ utils_1.universalLog.warn(`more than one icon node found`, iconNodes.length, iconNodes);
68
68
  return null;
69
69
  }
70
70
  const icon = iconNodes[0];
@@ -82,7 +82,7 @@ function isWalletIconSizeMatch(walletIcon) {
82
82
  width > consts_1.ICON_MIN_SIZE &&
83
83
  height < consts_1.ICON_MAX_SIZE &&
84
84
  height > consts_1.ICON_MIN_SIZE;
85
- !isMatch && utils_1.universalLog.log('===>wallet icon size doesnot match: ', width, height);
85
+ !isMatch && utils_1.universalLog.log('wallet icon size doesnot match: ', width, height);
86
86
  return isMatch;
87
87
  }
88
88
  exports.isWalletIconSizeMatch = isWalletIconSizeMatch;
@@ -30,7 +30,7 @@ function hackWalletConnectButton(sites) {
30
30
  if (walletId.isUpdated) {
31
31
  continue;
32
32
  }
33
- utils_1.universalLog.log(`===>[replaceMethod] ${urls[0]} begin to run for ${walletId.walletId}`);
33
+ utils_1.universalLog.log(`[replaceMethod] ${urls[0]} begin to run for ${walletId.walletId}`);
34
34
  let result = null;
35
35
  if (update) {
36
36
  const newIconElement = update(wallet);
@@ -46,12 +46,13 @@ function hackWalletConnectButton(sites) {
46
46
  ? document.querySelector(container)
47
47
  : container();
48
48
  if (!containerElement) {
49
+ utils_1.universalLog.warn('containerElement is null, container=', container);
49
50
  continue;
50
51
  }
51
52
  result = (0, findIconAndName_1.findIconAndNameByParent)(containerElement, name, constraintMap);
52
53
  }
53
54
  if (!result) {
54
- utils_1.universalLog.warn('==>warn: no result found');
55
+ utils_1.universalLog.warn('no result found');
55
56
  continue;
56
57
  }
57
58
  const { textNode, iconNode } = result;
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findIconAndNameInShadowRoot = void 0;
4
4
  const findIconAndName_1 = require("./findIconAndName");
5
5
  const utils_1 = require("./utils");
6
- function findIconAndNameInShadowRoot(hostSelector, containerSelector, walletName) {
6
+ const imgUtils_1 = require("./imgUtils");
7
+ function findIconAndNameInShadowRoot(hostSelector, containerSelector, walletName, constraints = {
8
+ text: [utils_1.isClickable],
9
+ icon: [imgUtils_1.isWalletIconSizeMatch, utils_1.isClickable],
10
+ }) {
7
11
  const shadowRoots = Array.from(document.querySelectorAll(hostSelector))
8
12
  .filter(Boolean)
9
13
  .map((e) => e.shadowRoot);
@@ -20,6 +24,6 @@ function findIconAndNameInShadowRoot(hostSelector, containerSelector, walletName
20
24
  utils_1.universalLog.warn('findIconAndNameInShadowRoot,length=', length);
21
25
  return null;
22
26
  }
23
- return (0, findIconAndName_1.findIconAndNameByParent)(containerElements[0], walletName);
27
+ return (0, findIconAndName_1.findIconAndNameByParent)(containerElements[0], walletName, constraints);
24
28
  }
25
29
  exports.findIconAndNameInShadowRoot = findIconAndNameInShadowRoot;
@@ -31,15 +31,15 @@ function findWalletTextByParent(container, walletName, constraints) {
31
31
  const textNodes = utilsDomNodes_1.default.findTextNode(container, walletName, 'all');
32
32
  const length = (textNodes === null || textNodes === void 0 ? void 0 : textNodes.length) || 0;
33
33
  if (length === 0 || !textNodes) {
34
- utils_1.universalLog.warn(`===>find none for wallet name ${walletName.toString()}`);
34
+ utils_1.universalLog.warn(`find none for wallet name ${walletName.toString()}, container is `, container);
35
35
  return null;
36
36
  }
37
37
  if (length > 1) {
38
- utils_1.universalLog.warn(`===>find more than one text node for wallet name ${walletName.toString()}`);
38
+ utils_1.universalLog.warn(`find more than one text node for wallet name ${walletName.toString()}`);
39
39
  return null;
40
40
  }
41
41
  if (constraints.some((f) => !textNodes[0].parentElement || !f(textNodes[0].parentElement))) {
42
- utils_1.universalLog.warn('===>it doesnot satisfy the constraints');
42
+ utils_1.universalLog.warn('it doesnot satisfy the constraints');
43
43
  return null;
44
44
  }
45
45
  return textNodes[0];
@@ -17,6 +17,7 @@ const onekey_sui_provider_1 = require("@onekeyfe/onekey-sui-provider");
17
17
  const onekey_webln_provider_1 = require("@onekeyfe/onekey-webln-provider");
18
18
  const onekey_nostr_provider_1 = require("@onekeyfe/onekey-nostr-provider");
19
19
  const onekey_btc_provider_1 = require("@onekeyfe/onekey-btc-provider");
20
+ const onekey_algo_provider_1 = require("@onekeyfe/onekey-algo-provider");
20
21
  const connectButtonHack_1 = require("./connectButtonHack");
21
22
  const detectRiskWebsite_1 = require("./detectRiskWebsite");
22
23
  const consts_1 = require("./connectButtonHack/consts");
@@ -67,6 +68,7 @@ function injectWeb3Provider() {
67
68
  });
68
69
  const btc = new onekey_btc_provider_1.ProviderBtc({ bridge });
69
70
  const btcWallet = new onekey_btc_provider_1.ProviderBtcWallet({ bridge });
71
+ const algorand = new onekey_algo_provider_1.ProviderAlgo({ bridge });
70
72
  const $privateExternalAccount = new onekey_private_external_account_provider_1.ProviderPrivateExternalAccount({ bridge });
71
73
  // providerHub
72
74
  const $onekey = Object.assign(Object.assign({}, window.$onekey), { jsBridge: bridge, $private,
@@ -79,7 +81,7 @@ function injectWeb3Provider() {
79
81
  cosmos,
80
82
  webln,
81
83
  nostr,
82
- btc, btcwallet: btcWallet });
84
+ btc, btcwallet: btcWallet, algorand });
83
85
  (0, cross_inpage_provider_core_1.defineWindowProperty)('$onekey', $onekey, { enumerable: true });
84
86
  const martianProxy = new Proxy(martian, {
85
87
  get: (target, property, ...args) => {
@@ -115,6 +117,10 @@ function injectWeb3Provider() {
115
117
  (0, cross_inpage_provider_core_1.defineWindowProperty)('suiWallet', sui);
116
118
  (0, cross_inpage_provider_core_1.defineWindowProperty)('unisat', btc);
117
119
  (0, cross_inpage_provider_core_1.defineWindowProperty)('btcwallet', btcWallet);
120
+ (0, cross_inpage_provider_core_1.defineWindowProperty)('algorand', algorand);
121
+ (0, cross_inpage_provider_core_1.defineWindowProperty)('exodus', {
122
+ algorand,
123
+ });
118
124
  // Cardano chain provider injection is handled independently.
119
125
  if ((0, cross_inpage_provider_core_1.checkWalletSwitchEnable)()) {
120
126
  (0, onekey_cardano_provider_1.defineWindowCardanoProperty)('cardano', cardano);
@@ -107,6 +107,13 @@ export declare type WalletInfo = {
107
107
  * used when there is only one icon or name element(not both) and other special cases
108
108
  */
109
109
  update?: (this: void, wallet: WalletInfo) => HTMLImageElement | null;
110
+ /**
111
+ * skip testing
112
+ */
113
+ skip?: boolean | {
114
+ mobile?: boolean;
115
+ desktop?: boolean;
116
+ };
110
117
  };
111
118
  export declare type SitesInfo = {
112
119
  urls: string[];
@@ -40,7 +40,7 @@ export const basicWalletInfo = {
40
40
  [WALLET_NAMES.petra]: {
41
41
  updatedIcon: WALLET_CONNECT_INFO.petra.icon,
42
42
  updatedName: WALLET_CONNECT_INFO.petra.text,
43
- name: /^Petra$/i,
43
+ name: /^(Petra|Petra Wallet)$/i,
44
44
  },
45
45
  [WALLET_NAMES.keplr]: {
46
46
  updatedIcon: WALLET_CONNECT_INFO.keplr.icon,
@@ -1410,22 +1410,42 @@ export const sitesConfig = [
1410
1410
  },
1411
1411
  },
1412
1412
  {
1413
+ //mobile version is redirected to app-mobile.ariesmarkets.xyz. check next item
1413
1414
  urls: ['app.ariesmarkets.xyz'],
1414
1415
  testUrls: ['app.ariesmarkets.xyz/lending'],
1415
- // mutationObserverOptions: {
1416
- // childList: true,
1417
- // subtree: true,
1418
- // attributes: true,
1419
- // },
1420
- //TODO: mobile version
1421
1416
  constraintMap: { icon: [isWalletIconSizeMatch], text: [] },
1422
1417
  walletsForProvider: {
1423
1418
  [IInjectedProviderNames.aptos]: [
1424
- Object.assign(Object.assign({}, basicWalletInfo['petra']), { container: () => {
1425
- var _a, _b, _c;
1426
- const pc = getConnectWalletModalByTitle('div.mantine-Paper-root', 'Select Wallet');
1419
+ Object.assign(Object.assign({}, basicWalletInfo['petra']), { container: () => getConnectWalletModalByTitle('div.mantine-Paper-root', 'Select Wallet') }),
1420
+ ],
1421
+ },
1422
+ },
1423
+ {
1424
+ urls: ['app-mobile.ariesmarkets.xyz'],
1425
+ constraintMap: { icon: [isWalletIconSizeMatch], text: [] },
1426
+ walletsForProvider: {
1427
+ [IInjectedProviderNames.aptos]: [
1428
+ Object.assign(Object.assign({}, basicWalletInfo['petra']), { findIconAndName({ name }) {
1429
+ var _a, _b, _c, _d, _e, _f;
1427
1430
  const mobileTitle = domUtils.findTextNode('#root', 'Select Wallet', 'first') || null;
1428
- 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);
1431
+ const modal = ((_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;
1432
+ if (!modal) {
1433
+ return null;
1434
+ }
1435
+ //there is multiple wallet icons, so we need to find the correct one manually
1436
+ const text = domUtils.findTextNode(modal, name, 'first');
1437
+ const imgs = Array.from(((_f = (_e = (_d = text.parentElement) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.parentElement) === null || _f === void 0 ? void 0 : _f.querySelectorAll('div[style*="background-image"]')) || []);
1438
+ if (imgs.length > 1 || imgs.length === 0) {
1439
+ return null;
1440
+ }
1441
+ const img = imgs[0];
1442
+ if (!text || !img) {
1443
+ return null;
1444
+ }
1445
+ return {
1446
+ iconNode: img,
1447
+ textNode: text,
1448
+ };
1429
1449
  } }),
1430
1450
  ],
1431
1451
  },
@@ -1491,4 +1511,197 @@ export const sitesConfig = [
1491
1511
  ],
1492
1512
  },
1493
1513
  },
1514
+ {
1515
+ urls: ['agni.finance'],
1516
+ walletsForProvider: {
1517
+ [IInjectedProviderNames.ethereum]: [
1518
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
1519
+ const modal = getConnectWalletModalByTitle('div.inside', 'Connect Wallet') ||
1520
+ getConnectWalletModalByTitle('div[role="dialog"]', 'Start by connecting with one');
1521
+ return (modal &&
1522
+ findIconAndNameDirectly('img[src*="metamask.png"]', 'auto-search-text', name, modal));
1523
+ } }),
1524
+ ],
1525
+ },
1526
+ },
1527
+ {
1528
+ urls: ['liquidswap.com'],
1529
+ testPath: [
1530
+ ':text("I accept the")',
1531
+ ':text("Continue")',
1532
+ ':text("Connect Wallet")',
1533
+ ':text("Other Wallets")',
1534
+ ],
1535
+ walletsForProvider: {
1536
+ [IInjectedProviderNames.aptos]: [
1537
+ Object.assign(Object.assign({}, basicWalletInfo['petra']), { findIconAndName({ name }) {
1538
+ const modal = getConnectWalletModalByTitle('div.p-dialog', 'Connect a Wallet');
1539
+ return (modal &&
1540
+ findIconAndNameDirectly('img[alt="Petra Wallet"]', 'auto-search-text', name, modal));
1541
+ } }),
1542
+ ],
1543
+ },
1544
+ },
1545
+ // {
1546
+ // urls: ['stbt.matrixdock.com'],
1547
+ // walletsForProvider: {
1548
+ // [IInjectedProviderNames.ethereum]: [
1549
+ // {
1550
+ // ...basicWalletInfo['metamask'],
1551
+ // findIconAndName({ name }) {
1552
+ // const modal = getConnectWalletModalByTitle('div.inside', 'Connect Wallet');
1553
+ // return (
1554
+ // modal &&
1555
+ // findIconAndNameDirectly('img[src*="metamask.png"]', 'auto-search-text', name, modal)
1556
+ // );
1557
+ // },
1558
+ // },
1559
+ // ],
1560
+ // },
1561
+ // },
1562
+ {
1563
+ urls: ['spooky.fi'],
1564
+ walletsForProvider: {
1565
+ [IInjectedProviderNames.ethereum]: [
1566
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'div[data-testid="wallet-modal"]' }),
1567
+ Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { container: 'div[data-testid="wallet-modal"]', skip: { mobile: true } }),
1568
+ ],
1569
+ },
1570
+ },
1571
+ {
1572
+ urls: ['usyc.hashnote.com'],
1573
+ testPath: [':text("Connect your wallet")'],
1574
+ walletsForProvider: {
1575
+ [IInjectedProviderNames.ethereum]: [
1576
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
1577
+ var _a;
1578
+ const shadowRoot = (_a = document.querySelector('div[data-testid="dynamic-modal-shadow"]')) === null || _a === void 0 ? void 0 : _a.shadowRoot;
1579
+ if (!shadowRoot) {
1580
+ return null;
1581
+ }
1582
+ const parent = shadowRoot.querySelector('div.wallet-list__container');
1583
+ return (parent &&
1584
+ findIconAndNameDirectly('img[data-testid="wallet-icon-metamask"]', 'auto-search-text', name, parent));
1585
+ } }),
1586
+ ],
1587
+ },
1588
+ },
1589
+ {
1590
+ urls: ['polygon.tangible.store'],
1591
+ testPath: {
1592
+ mobile: ['header button img'],
1593
+ desktop: [':text("Connect")'],
1594
+ },
1595
+ walletsForProvider: {
1596
+ [IInjectedProviderNames.ethereum]: [
1597
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
1598
+ const modal = getConnectWalletModalByTitle('div[role="dialog"]', 'Connect wallet');
1599
+ return (modal &&
1600
+ findIconAndNameDirectly('img[src*="metamask.svg"][alt="MetaMask icon"]', 'auto-search-text', name, modal));
1601
+ } }),
1602
+ ],
1603
+ },
1604
+ },
1605
+ {
1606
+ urls: ['apps.acala.network'],
1607
+ only: true,
1608
+ walletsForProvider: {
1609
+ [IInjectedProviderNames.polkadot]: [
1610
+ Object.assign(Object.assign({}, basicWalletInfo['polkadot']), { findIconAndName() {
1611
+ const modal = getConnectWalletModalByTitle('div[role="dialog"]', 'Connect Wallet');
1612
+ return (modal &&
1613
+ findIconAndNameDirectly('img[alt="Polkadotjs Logo"]', 'auto-search-text', /^Polkadot/, modal));
1614
+ } }),
1615
+ ],
1616
+ },
1617
+ },
1618
+ {
1619
+ urls: ['app.rhino.fi'],
1620
+ testPath: [':text("Allow All")', ':text("connect wallet")'],
1621
+ constraintMap: { icon: [], text: [] },
1622
+ walletsForProvider: {
1623
+ [IInjectedProviderNames.ethereum]: [
1624
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: '#metamask' }),
1625
+ Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { container: '#walletConnect' }),
1626
+ ],
1627
+ },
1628
+ },
1629
+ {
1630
+ urls: ['app.zero.button.finance'],
1631
+ testPath: { mobile: ['header button svg', ':text("Connect")'], desktop: [':text("Connect")'] },
1632
+ walletsForProvider: {
1633
+ [IInjectedProviderNames.ethereum]: [
1634
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'ul.bn-onboard-modal-select-wallets' }),
1635
+ ],
1636
+ },
1637
+ },
1638
+ {
1639
+ urls: ['blast.io'],
1640
+ testUrls: ['blast.io/zh-CN/bridge'],
1641
+ testPath: [':text("Jackpot deck")', ":text('连接钱包')"],
1642
+ walletsForProvider: {
1643
+ [IInjectedProviderNames.ethereum]: [
1644
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'div[aria-label="选择要连接的钱包"]' }),
1645
+ ],
1646
+ },
1647
+ },
1648
+ {
1649
+ urls: ['app.ichi.org'],
1650
+ skip: true,
1651
+ walletsForProvider: {
1652
+ [IInjectedProviderNames.ethereum]: [
1653
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'button[data-testid="rk-wallet-option-metaMask"]' }),
1654
+ Object.assign(Object.assign({}, basicWalletInfo['walletconnect']), { container: 'button[data-testid="rk-wallet-option-walletConnect"]' }),
1655
+ ],
1656
+ },
1657
+ },
1658
+ {
1659
+ urls: ['klayswap.com'],
1660
+ walletsForProvider: {
1661
+ [IInjectedProviderNames.ethereum]: [
1662
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'div.SelectWalletModal', afterUpdate(textNode, icon) {
1663
+ if (textNode.parentElement) {
1664
+ textNode.parentElement.style.flexShrink = '0';
1665
+ textNode.parentElement.style.width = '100%';
1666
+ }
1667
+ icon.style.height = 'auto';
1668
+ } }),
1669
+ ],
1670
+ },
1671
+ },
1672
+ {
1673
+ urls: ['dojo.trading'],
1674
+ walletsForProvider: {
1675
+ [IInjectedProviderNames.ethereum]: [
1676
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { findIconAndName({ name }) {
1677
+ const modal = getConnectWalletModalByTitle('div[role="dialog"]', 'Connect Wallet');
1678
+ return (modal &&
1679
+ findIconAndNameDirectly('img[src*="metamask.svg"][alt="Metamask"]', 'auto-search-text', name, modal));
1680
+ },
1681
+ afterUpdate(textNode, icon) {
1682
+ icon.style.marginRight = '12px';
1683
+ } }),
1684
+ ],
1685
+ [IInjectedProviderNames.cosmos]: [
1686
+ Object.assign(Object.assign({}, basicWalletInfo['keplr']), { findIconAndName({ name }) {
1687
+ const modal = getConnectWalletModalByTitle('div[role="dialog"]', 'Connect Wallet');
1688
+ return (modal &&
1689
+ findIconAndNameDirectly('img[src*="keplr.svg"][alt="Keplr"]', 'auto-search-text', name, modal));
1690
+ },
1691
+ afterUpdate(textNode, icon) {
1692
+ icon.style.marginRight = '12px';
1693
+ } }),
1694
+ ],
1695
+ },
1696
+ },
1697
+ {
1698
+ urls: ['gains.trade'],
1699
+ testUrls: ['gains.trade/trading#BTC-USD'],
1700
+ testPath: ['button:has-text("Agree")', ':text("Connect Wallet")'],
1701
+ walletsForProvider: {
1702
+ [IInjectedProviderNames.ethereum]: [
1703
+ Object.assign(Object.assign({}, basicWalletInfo['metamask']), { container: 'button[data-testid="rk-wallet-option-metaMask"]' }),
1704
+ ],
1705
+ },
1706
+ },
1494
1707
  ];
@@ -1,5 +1,5 @@
1
1
  export declare const MAX_LEVELS = 4;
2
- export declare const MAX_SEARCH_LEVELS_By_IMG = 3;
2
+ export declare const MAX_SEARCH_LEVELS_By_IMG = 4;
3
3
  export declare const DISTNACE_BETWEEN_ICON_AND_TEXT = 100;
4
4
  export declare const ICON_MAX_SIZE = 150;
5
5
  export declare const ICON_MIN_SIZE = 10;
@@ -1,5 +1,5 @@
1
1
  export const MAX_LEVELS = 4;
2
- export const MAX_SEARCH_LEVELS_By_IMG = 3;
2
+ export const MAX_SEARCH_LEVELS_By_IMG = 4;
3
3
  export const DISTNACE_BETWEEN_ICON_AND_TEXT = 100;
4
4
  export const ICON_MAX_SIZE = 150;
5
5
  export const ICON_MIN_SIZE = 10;
@@ -14,11 +14,11 @@ export function findIconAndNameByParent(containerElement, walletName, constraint
14
14
  }) {
15
15
  const textNode = findWalletTextByParent(containerElement, walletName, constraints.text);
16
16
  if (!textNode || !textNode.parentElement) {
17
- universalLog.log(`===>no wallet name ${walletName.toString()} text node found`);
17
+ universalLog.log(`no wallet name ${walletName.toString()} text node found`);
18
18
  return null;
19
19
  }
20
20
  if (isInExternalLink(textNode.parentElement, containerElement)) {
21
- universalLog.log(`===>${walletName.toString()} is in external link`);
21
+ universalLog.log(`${walletName.toString()} is in external link`);
22
22
  return null;
23
23
  }
24
24
  let parent = textNode.parentElement;
@@ -35,7 +35,7 @@ export function findIconAndNameByParent(containerElement, walletName, constraint
35
35
  break;
36
36
  }
37
37
  if (!iconNode) {
38
- universalLog.log(`===>no wallet ${walletName.toString()} icon node found`);
38
+ universalLog.log(`no wallet ${walletName.toString()} icon node found`);
39
39
  return null;
40
40
  }
41
41
  // make sure the icon and text are both existed
@@ -97,6 +97,6 @@ export function findTextByImg(img, walletName, containerLimit, constraints, maxL
97
97
  }
98
98
  parent = parent.parentElement;
99
99
  }
100
- universalLog.warn('can not find the text node by img', level);
100
+ universalLog.warn('can not find the text node by img ', level);
101
101
  return null;
102
102
  }
@@ -5,7 +5,7 @@ import { universalLog } from './utils';
5
5
  */
6
6
  export function replaceIcon(originalNode, newIconSrc) {
7
7
  const computedstyle = window.getComputedStyle(originalNode);
8
- universalLog.log('===>ok: replace icon', originalNode);
8
+ universalLog.log('ok: replace icon', originalNode);
9
9
  const width = parseFloat(computedstyle.width) ? computedstyle.width : 'auto';
10
10
  const height = parseFloat(computedstyle.height) ? computedstyle.height : 'auto';
11
11
  if (originalNode instanceof HTMLImageElement) {
@@ -54,11 +54,11 @@ export function findIconNodesByParent(parent) {
54
54
  export function findWalletIconByParent(parent, constraints) {
55
55
  const iconNodes = findIconNodesByParent(parent);
56
56
  if (iconNodes.length === 0) {
57
- universalLog.warn(`===>no icon node found`, parent);
57
+ universalLog.warn(`no icon node found`, parent);
58
58
  return null;
59
59
  }
60
60
  if (iconNodes.length > 1) {
61
- universalLog.warn(`===>more than one icon node found`, iconNodes.length, iconNodes);
61
+ universalLog.warn(`more than one icon node found`, iconNodes.length, iconNodes);
62
62
  return null;
63
63
  }
64
64
  const icon = iconNodes[0];
@@ -75,6 +75,6 @@ export function isWalletIconSizeMatch(walletIcon) {
75
75
  width > ICON_MIN_SIZE &&
76
76
  height < ICON_MAX_SIZE &&
77
77
  height > ICON_MIN_SIZE;
78
- !isMatch && universalLog.log('===>wallet icon size doesnot match: ', width, height);
78
+ !isMatch && universalLog.log('wallet icon size doesnot match: ', width, height);
79
79
  return isMatch;
80
80
  }
@@ -28,7 +28,7 @@ function hackWalletConnectButton(sites) {
28
28
  if (walletId.isUpdated) {
29
29
  continue;
30
30
  }
31
- universalLog.log(`===>[replaceMethod] ${urls[0]} begin to run for ${walletId.walletId}`);
31
+ universalLog.log(`[replaceMethod] ${urls[0]} begin to run for ${walletId.walletId}`);
32
32
  let result = null;
33
33
  if (update) {
34
34
  const newIconElement = update(wallet);
@@ -44,12 +44,13 @@ function hackWalletConnectButton(sites) {
44
44
  ? document.querySelector(container)
45
45
  : container();
46
46
  if (!containerElement) {
47
+ universalLog.warn('containerElement is null, container=', container);
47
48
  continue;
48
49
  }
49
50
  result = defaultFindIconAndName(containerElement, name, constraintMap);
50
51
  }
51
52
  if (!result) {
52
- universalLog.warn('==>warn: no result found');
53
+ universalLog.warn('no result found');
53
54
  continue;
54
55
  }
55
56
  const { textNode, iconNode } = result;
@@ -1,2 +1,5 @@
1
- import { FindResultType, Selector } from './type';
2
- export declare function findIconAndNameInShadowRoot(hostSelector: Selector, containerSelector: Selector, walletName: RegExp): FindResultType | null;
1
+ import { ConstraintFn, FindResultType, Selector } from './type';
2
+ export declare function findIconAndNameInShadowRoot(hostSelector: Selector, containerSelector: Selector, walletName: RegExp, constraints?: {
3
+ text: ConstraintFn[];
4
+ icon: ConstraintFn[];
5
+ }): FindResultType | null;
@@ -1,6 +1,10 @@
1
1
  import { findIconAndNameByParent } from './findIconAndName';
2
- import { universalLog } from './utils';
3
- export function findIconAndNameInShadowRoot(hostSelector, containerSelector, walletName) {
2
+ import { isClickable, universalLog } from './utils';
3
+ import { isWalletIconSizeMatch } from './imgUtils';
4
+ export function findIconAndNameInShadowRoot(hostSelector, containerSelector, walletName, constraints = {
5
+ text: [isClickable],
6
+ icon: [isWalletIconSizeMatch, isClickable],
7
+ }) {
4
8
  const shadowRoots = Array.from(document.querySelectorAll(hostSelector))
5
9
  .filter(Boolean)
6
10
  .map((e) => e.shadowRoot);
@@ -17,5 +21,5 @@ export function findIconAndNameInShadowRoot(hostSelector, containerSelector, wal
17
21
  universalLog.warn('findIconAndNameInShadowRoot,length=', length);
18
22
  return null;
19
23
  }
20
- return findIconAndNameByParent(containerElements[0], walletName);
24
+ return findIconAndNameByParent(containerElements[0], walletName, constraints);
21
25
  }
@@ -23,15 +23,15 @@ export function findWalletTextByParent(container, walletName, constraints) {
23
23
  const textNodes = domUtils.findTextNode(container, walletName, 'all');
24
24
  const length = (textNodes === null || textNodes === void 0 ? void 0 : textNodes.length) || 0;
25
25
  if (length === 0 || !textNodes) {
26
- universalLog.warn(`===>find none for wallet name ${walletName.toString()}`);
26
+ universalLog.warn(`find none for wallet name ${walletName.toString()}, container is `, container);
27
27
  return null;
28
28
  }
29
29
  if (length > 1) {
30
- universalLog.warn(`===>find more than one text node for wallet name ${walletName.toString()}`);
30
+ universalLog.warn(`find more than one text node for wallet name ${walletName.toString()}`);
31
31
  return null;
32
32
  }
33
33
  if (constraints.some((f) => !textNodes[0].parentElement || !f(textNodes[0].parentElement))) {
34
- universalLog.warn('===>it doesnot satisfy the constraints');
34
+ universalLog.warn('it doesnot satisfy the constraints');
35
35
  return null;
36
36
  }
37
37
  return textNodes[0];
@@ -6,7 +6,7 @@ import { ProviderAptosMartian } from '@onekeyfe/onekey-aptos-provider';
6
6
  import { ProviderConflux } from '@onekeyfe/onekey-conflux-provider';
7
7
  import { ProviderTron } from '@onekeyfe/onekey-tron-provider';
8
8
  import { ProviderCardano, defineWindowCardanoProperty } from '@onekeyfe/onekey-cardano-provider';
9
- import { ProviderPrivateExternalAccount } from "@onekeyfe/onekey-private-external-account-provider";
9
+ import { ProviderPrivateExternalAccount } from '@onekeyfe/onekey-private-external-account-provider';
10
10
  import { ProviderCosmos } from '@onekeyfe/onekey-cosmos-provider';
11
11
  import { ProviderPolkadot, registerPolkadot } from '@onekeyfe/onekey-polkadot-provider';
12
12
  import { defineWindowProperty, checkWalletSwitchEnable, } from '@onekeyfe/cross-inpage-provider-core';
@@ -14,6 +14,7 @@ import { ProviderSui, registerSuiWallet } from '@onekeyfe/onekey-sui-provider';
14
14
  import { ProviderWebln } from '@onekeyfe/onekey-webln-provider';
15
15
  import { ProviderNostr } from '@onekeyfe/onekey-nostr-provider';
16
16
  import { ProviderBtc, ProviderBtcWallet } from '@onekeyfe/onekey-btc-provider';
17
+ import { ProviderAlgo } from '@onekeyfe/onekey-algo-provider';
17
18
  import { hackAllConnectButtons } from './connectButtonHack';
18
19
  import { detectWebsiteRiskLevel } from './detectRiskWebsite';
19
20
  import { WALLET_CONNECT_INFO } from './connectButtonHack/consts';
@@ -64,6 +65,7 @@ function injectWeb3Provider() {
64
65
  });
65
66
  const btc = new ProviderBtc({ bridge });
66
67
  const btcWallet = new ProviderBtcWallet({ bridge });
68
+ const algorand = new ProviderAlgo({ bridge });
67
69
  const $privateExternalAccount = new ProviderPrivateExternalAccount({ bridge });
68
70
  // providerHub
69
71
  const $onekey = Object.assign(Object.assign({}, window.$onekey), { jsBridge: bridge, $private,
@@ -76,7 +78,7 @@ function injectWeb3Provider() {
76
78
  cosmos,
77
79
  webln,
78
80
  nostr,
79
- btc, btcwallet: btcWallet });
81
+ btc, btcwallet: btcWallet, algorand });
80
82
  defineWindowProperty('$onekey', $onekey, { enumerable: true });
81
83
  const martianProxy = new Proxy(martian, {
82
84
  get: (target, property, ...args) => {
@@ -112,6 +114,10 @@ function injectWeb3Provider() {
112
114
  defineWindowProperty('suiWallet', sui);
113
115
  defineWindowProperty('unisat', btc);
114
116
  defineWindowProperty('btcwallet', btcWallet);
117
+ defineWindowProperty('algorand', algorand);
118
+ defineWindowProperty('exodus', {
119
+ algorand,
120
+ });
115
121
  // Cardano chain provider injection is handled independently.
116
122
  if (checkWalletSwitchEnable()) {
117
123
  defineWindowCardanoProperty('cardano', cardano);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/inpage-providers-hub",
3
- "version": "2.0.0-alpha.7",
3
+ "version": "2.0.0-alpha.8",
4
4
  "keywords": [
5
5
  "cross-inpage-provider"
6
6
  ],
@@ -28,24 +28,25 @@
28
28
  "start": "tsc --watch"
29
29
  },
30
30
  "dependencies": {
31
- "@onekeyfe/cross-inpage-provider-core": "2.0.0-alpha.7",
32
- "@onekeyfe/cross-inpage-provider-types": "2.0.0-alpha.7",
33
- "@onekeyfe/onekey-aptos-provider": "2.0.0-alpha.7",
34
- "@onekeyfe/onekey-btc-provider": "2.0.0-alpha.7",
35
- "@onekeyfe/onekey-cardano-provider": "2.0.0-alpha.7",
36
- "@onekeyfe/onekey-conflux-provider": "2.0.0-alpha.7",
37
- "@onekeyfe/onekey-cosmos-provider": "2.0.0-alpha.7",
38
- "@onekeyfe/onekey-eth-provider": "2.0.0-alpha.7",
39
- "@onekeyfe/onekey-nostr-provider": "2.0.0-alpha.7",
40
- "@onekeyfe/onekey-polkadot-provider": "2.0.0-alpha.7",
41
- "@onekeyfe/onekey-private-external-account-provider": "2.0.0-alpha.7",
42
- "@onekeyfe/onekey-private-provider": "2.0.0-alpha.7",
43
- "@onekeyfe/onekey-solana-provider": "2.0.0-alpha.7",
44
- "@onekeyfe/onekey-starcoin-provider": "2.0.0-alpha.7",
45
- "@onekeyfe/onekey-sui-provider": "2.0.0-alpha.7",
46
- "@onekeyfe/onekey-tron-provider": "2.0.0-alpha.7",
47
- "@onekeyfe/onekey-webln-provider": "2.0.0-alpha.7",
31
+ "@onekeyfe/cross-inpage-provider-core": "2.0.0-alpha.8",
32
+ "@onekeyfe/cross-inpage-provider-types": "2.0.0-alpha.8",
33
+ "@onekeyfe/onekey-algo-provider": "2.0.0-alpha.8",
34
+ "@onekeyfe/onekey-aptos-provider": "2.0.0-alpha.8",
35
+ "@onekeyfe/onekey-btc-provider": "2.0.0-alpha.8",
36
+ "@onekeyfe/onekey-cardano-provider": "2.0.0-alpha.8",
37
+ "@onekeyfe/onekey-conflux-provider": "2.0.0-alpha.8",
38
+ "@onekeyfe/onekey-cosmos-provider": "2.0.0-alpha.8",
39
+ "@onekeyfe/onekey-eth-provider": "2.0.0-alpha.8",
40
+ "@onekeyfe/onekey-nostr-provider": "2.0.0-alpha.8",
41
+ "@onekeyfe/onekey-polkadot-provider": "2.0.0-alpha.8",
42
+ "@onekeyfe/onekey-private-external-account-provider": "2.0.0-alpha.8",
43
+ "@onekeyfe/onekey-private-provider": "2.0.0-alpha.8",
44
+ "@onekeyfe/onekey-solana-provider": "2.0.0-alpha.8",
45
+ "@onekeyfe/onekey-starcoin-provider": "2.0.0-alpha.8",
46
+ "@onekeyfe/onekey-sui-provider": "2.0.0-alpha.8",
47
+ "@onekeyfe/onekey-tron-provider": "2.0.0-alpha.8",
48
+ "@onekeyfe/onekey-webln-provider": "2.0.0-alpha.8",
48
49
  "web3": "^1.7.3"
49
50
  },
50
- "gitHead": "4973c47364a6f6c8533596b11edbb308db360893"
51
+ "gitHead": "a72404c2d39b3910aa62c137be02e4643c3b59f0"
51
52
  }