@omnisat/lasereyes 0.0.22 → 0.0.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.
Files changed (3) hide show
  1. package/dist/index.js +100 -31
  2. package/dist/index.mjs +100 -31
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -546,50 +546,119 @@ var LaserEyesProvider = ({
546
546
  }
547
547
  }, [config, library]);
548
548
  (0, import_react.useEffect)(() => {
549
- const unisatLib = window == null ? void 0 : window.unisat;
550
- setHasUnisat(!!unisatLib);
551
- }, []);
552
- (0, import_react.useEffect)(() => {
553
- var _a;
554
- const xverseLib = (_a = window == null ? void 0 : window.XverseProviders) == null ? void 0 : _a.BitcoinProvider;
555
- setHasXverse(!!xverseLib);
549
+ const observer = new MutationObserver(() => {
550
+ const unisatLib = window == null ? void 0 : window.unisat;
551
+ if (unisatLib) {
552
+ setHasUnisat(true);
553
+ observer.disconnect();
554
+ }
555
+ });
556
+ observer.observe(document, { childList: true, subtree: true });
557
+ return () => {
558
+ observer.disconnect();
559
+ };
556
560
  }, []);
557
561
  (0, import_react.useEffect)(() => {
558
- const oylLib = window == null ? void 0 : window.oyl;
559
- setHasOyl(!!oylLib);
562
+ const observer = new MutationObserver(() => {
563
+ var _a;
564
+ const xverseLib = (_a = window == null ? void 0 : window.XverseProviders) == null ? void 0 : _a.BitcoinProvider;
565
+ if (xverseLib) {
566
+ setHasXverse(true);
567
+ observer.disconnect();
568
+ }
569
+ });
570
+ observer.observe(document, { childList: true, subtree: true });
571
+ return () => {
572
+ observer.disconnect();
573
+ };
560
574
  }, []);
561
575
  (0, import_react.useEffect)(() => {
562
- const magicEdenLib = window == null ? void 0 : window.magicEden;
563
- setHasMagicEden(!!magicEdenLib);
576
+ const observer = new MutationObserver(() => {
577
+ const oylLib = window == null ? void 0 : window.oyl;
578
+ if (oylLib) {
579
+ setHasOyl(true);
580
+ observer.disconnect();
581
+ }
582
+ });
583
+ observer.observe(document, { childList: true, subtree: true });
584
+ return () => {
585
+ observer.disconnect();
586
+ };
564
587
  }, []);
565
588
  (0, import_react.useEffect)(() => {
589
+ const observer = new MutationObserver(() => {
590
+ const magicEdenLib = window == null ? void 0 : window.magicEden;
591
+ if (magicEdenLib) {
592
+ setHasMagicEden(true);
593
+ observer.disconnect();
594
+ }
595
+ });
596
+ observer.observe(document, { childList: true, subtree: true });
597
+ return () => {
598
+ observer.disconnect();
599
+ };
566
600
  }, []);
567
601
  (0, import_react.useEffect)(() => {
568
- var _a, _b;
569
- let foundOkx;
570
- if (network === TESTNET) {
571
- foundOkx = (_a = window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
572
- } else if (network === MAINNET) {
573
- foundOkx = (_b = window.okxwallet) == null ? void 0 : _b.bitcoin;
574
- }
575
- setHasOkx(!!foundOkx);
576
- }, []);
602
+ const observer = new MutationObserver(() => {
603
+ var _a, _b;
604
+ let foundOkx;
605
+ if (network === TESTNET) {
606
+ foundOkx = (_a = window == null ? void 0 : window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
607
+ } else if (network === MAINNET) {
608
+ foundOkx = (_b = window == null ? void 0 : window.okxwallet) == null ? void 0 : _b.bitcoin;
609
+ }
610
+ if (foundOkx) {
611
+ setHasOkx(true);
612
+ observer.disconnect();
613
+ }
614
+ });
615
+ observer.observe(document, { childList: true, subtree: true });
616
+ return () => {
617
+ observer.disconnect();
618
+ };
619
+ }, [network]);
577
620
  (0, import_react.useEffect)(() => {
578
- const leatherLib = window == null ? void 0 : window.LeatherProvider;
579
- setHasLeather(!!leatherLib);
621
+ const observer = new MutationObserver(() => {
622
+ const leatherLib = window == null ? void 0 : window.LeatherProvider;
623
+ if (leatherLib) {
624
+ setHasLeather(true);
625
+ observer.disconnect();
626
+ }
627
+ });
628
+ observer.observe(document, { childList: true, subtree: true });
629
+ return () => {
630
+ observer.disconnect();
631
+ };
580
632
  }, []);
581
633
  (0, import_react.useEffect)(() => {
582
- var _a;
583
- const phantomLib = (_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.bitcoin;
584
- if (phantomLib && phantomLib.isPhantom) {
585
- setHasPhantom(!!phantomLib);
586
- } else {
587
- setHasPhantom(false);
588
- }
634
+ const observer = new MutationObserver(() => {
635
+ var _a;
636
+ const phantomLib = (_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.bitcoin;
637
+ if (phantomLib && phantomLib.isPhantom) {
638
+ setHasPhantom(true);
639
+ observer.disconnect();
640
+ } else {
641
+ setHasPhantom(false);
642
+ observer.disconnect();
643
+ }
644
+ });
645
+ observer.observe(document, { childList: true, subtree: true });
646
+ return () => {
647
+ observer.disconnect();
648
+ };
589
649
  }, []);
590
650
  (0, import_react.useEffect)(() => {
591
- const wissLib = window == null ? void 0 : window.wizz;
592
- setHasWizz(!!wissLib);
651
+ const observer = new MutationObserver(() => {
652
+ const wizzLib = window == null ? void 0 : window.wizz;
653
+ if (wizzLib) {
654
+ setHasWizz(true);
655
+ observer.disconnect();
656
+ }
657
+ });
658
+ observer.observe(document, { childList: true, subtree: true });
659
+ return () => {
660
+ observer.disconnect();
661
+ };
593
662
  }, []);
594
663
  (0, import_react.useEffect)(() => {
595
664
  setBalance(void 0);
package/dist/index.mjs CHANGED
@@ -468,50 +468,119 @@ var LaserEyesProvider = ({
468
468
  }
469
469
  }, [config, library]);
470
470
  useEffect(() => {
471
- const unisatLib = window == null ? void 0 : window.unisat;
472
- setHasUnisat(!!unisatLib);
473
- }, []);
474
- useEffect(() => {
475
- var _a;
476
- const xverseLib = (_a = window == null ? void 0 : window.XverseProviders) == null ? void 0 : _a.BitcoinProvider;
477
- setHasXverse(!!xverseLib);
471
+ const observer = new MutationObserver(() => {
472
+ const unisatLib = window == null ? void 0 : window.unisat;
473
+ if (unisatLib) {
474
+ setHasUnisat(true);
475
+ observer.disconnect();
476
+ }
477
+ });
478
+ observer.observe(document, { childList: true, subtree: true });
479
+ return () => {
480
+ observer.disconnect();
481
+ };
478
482
  }, []);
479
483
  useEffect(() => {
480
- const oylLib = window == null ? void 0 : window.oyl;
481
- setHasOyl(!!oylLib);
484
+ const observer = new MutationObserver(() => {
485
+ var _a;
486
+ const xverseLib = (_a = window == null ? void 0 : window.XverseProviders) == null ? void 0 : _a.BitcoinProvider;
487
+ if (xverseLib) {
488
+ setHasXverse(true);
489
+ observer.disconnect();
490
+ }
491
+ });
492
+ observer.observe(document, { childList: true, subtree: true });
493
+ return () => {
494
+ observer.disconnect();
495
+ };
482
496
  }, []);
483
497
  useEffect(() => {
484
- const magicEdenLib = window == null ? void 0 : window.magicEden;
485
- setHasMagicEden(!!magicEdenLib);
498
+ const observer = new MutationObserver(() => {
499
+ const oylLib = window == null ? void 0 : window.oyl;
500
+ if (oylLib) {
501
+ setHasOyl(true);
502
+ observer.disconnect();
503
+ }
504
+ });
505
+ observer.observe(document, { childList: true, subtree: true });
506
+ return () => {
507
+ observer.disconnect();
508
+ };
486
509
  }, []);
487
510
  useEffect(() => {
511
+ const observer = new MutationObserver(() => {
512
+ const magicEdenLib = window == null ? void 0 : window.magicEden;
513
+ if (magicEdenLib) {
514
+ setHasMagicEden(true);
515
+ observer.disconnect();
516
+ }
517
+ });
518
+ observer.observe(document, { childList: true, subtree: true });
519
+ return () => {
520
+ observer.disconnect();
521
+ };
488
522
  }, []);
489
523
  useEffect(() => {
490
- var _a, _b;
491
- let foundOkx;
492
- if (network === TESTNET) {
493
- foundOkx = (_a = window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
494
- } else if (network === MAINNET) {
495
- foundOkx = (_b = window.okxwallet) == null ? void 0 : _b.bitcoin;
496
- }
497
- setHasOkx(!!foundOkx);
498
- }, []);
524
+ const observer = new MutationObserver(() => {
525
+ var _a, _b;
526
+ let foundOkx;
527
+ if (network === TESTNET) {
528
+ foundOkx = (_a = window == null ? void 0 : window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
529
+ } else if (network === MAINNET) {
530
+ foundOkx = (_b = window == null ? void 0 : window.okxwallet) == null ? void 0 : _b.bitcoin;
531
+ }
532
+ if (foundOkx) {
533
+ setHasOkx(true);
534
+ observer.disconnect();
535
+ }
536
+ });
537
+ observer.observe(document, { childList: true, subtree: true });
538
+ return () => {
539
+ observer.disconnect();
540
+ };
541
+ }, [network]);
499
542
  useEffect(() => {
500
- const leatherLib = window == null ? void 0 : window.LeatherProvider;
501
- setHasLeather(!!leatherLib);
543
+ const observer = new MutationObserver(() => {
544
+ const leatherLib = window == null ? void 0 : window.LeatherProvider;
545
+ if (leatherLib) {
546
+ setHasLeather(true);
547
+ observer.disconnect();
548
+ }
549
+ });
550
+ observer.observe(document, { childList: true, subtree: true });
551
+ return () => {
552
+ observer.disconnect();
553
+ };
502
554
  }, []);
503
555
  useEffect(() => {
504
- var _a;
505
- const phantomLib = (_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.bitcoin;
506
- if (phantomLib && phantomLib.isPhantom) {
507
- setHasPhantom(!!phantomLib);
508
- } else {
509
- setHasPhantom(false);
510
- }
556
+ const observer = new MutationObserver(() => {
557
+ var _a;
558
+ const phantomLib = (_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.bitcoin;
559
+ if (phantomLib && phantomLib.isPhantom) {
560
+ setHasPhantom(true);
561
+ observer.disconnect();
562
+ } else {
563
+ setHasPhantom(false);
564
+ observer.disconnect();
565
+ }
566
+ });
567
+ observer.observe(document, { childList: true, subtree: true });
568
+ return () => {
569
+ observer.disconnect();
570
+ };
511
571
  }, []);
512
572
  useEffect(() => {
513
- const wissLib = window == null ? void 0 : window.wizz;
514
- setHasWizz(!!wissLib);
573
+ const observer = new MutationObserver(() => {
574
+ const wizzLib = window == null ? void 0 : window.wizz;
575
+ if (wizzLib) {
576
+ setHasWizz(true);
577
+ observer.disconnect();
578
+ }
579
+ });
580
+ observer.observe(document, { childList: true, subtree: true });
581
+ return () => {
582
+ observer.disconnect();
583
+ };
515
584
  }, []);
516
585
  useEffect(() => {
517
586
  setBalance(void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnisat/lasereyes",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "sideEffects": false,
5
5
  "private": false,
6
6
  "license": "MIT",