@omnisat/lasereyes 0.0.23 → 0.0.24

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/index.d.ts CHANGED
@@ -77,6 +77,7 @@ declare const WALLETS: {
77
77
  };
78
78
 
79
79
  type LaserEyesContextType = {
80
+ isInitializing: boolean;
80
81
  connected: boolean;
81
82
  isConnecting: boolean;
82
83
  publicKey: string;
package/dist/index.js CHANGED
@@ -288,6 +288,7 @@ var initialWalletContext = {
288
288
  hasLeather: false,
289
289
  hasPhantom: false,
290
290
  hasWizz: false,
291
+ isInitializing: true,
291
292
  connected: false,
292
293
  isConnecting: false,
293
294
  publicKey: "",
@@ -514,6 +515,7 @@ var LaserEyesProvider = ({
514
515
  const self = selfRef.current;
515
516
  const [library, setLibrary] = (0, import_react.useState)(null);
516
517
  const [provider, setProvider] = (0, import_react.useState)();
518
+ const [isInitializing, setIsInitializing] = (0, import_react.useState)(true);
517
519
  const [connected, setConnected] = (0, import_react.useState)(false);
518
520
  const [isConnecting, setIsConnecting] = (0, import_react.useState)(false);
519
521
  const [accounts, setAccounts] = (0, import_react.useState)([]);
@@ -545,6 +547,11 @@ var LaserEyesProvider = ({
545
547
  });
546
548
  }
547
549
  }, [config, library]);
550
+ const checkInitializationComplete = () => {
551
+ if (hasUnisat !== void 0 && hasXverse !== void 0 && hasOyl !== void 0 && hasMagicEden !== void 0 && hasOkx !== void 0 && hasLeather !== void 0 && hasPhantom !== void 0 && hasWizz !== void 0) {
552
+ setIsInitializing(false);
553
+ }
554
+ };
548
555
  (0, import_react.useEffect)(() => {
549
556
  const observer = new MutationObserver(() => {
550
557
  const unisatLib = window == null ? void 0 : window.unisat;
@@ -660,6 +667,18 @@ var LaserEyesProvider = ({
660
667
  observer.disconnect();
661
668
  };
662
669
  }, []);
670
+ (0, import_react.useEffect)(() => {
671
+ checkInitializationComplete();
672
+ }, [
673
+ hasUnisat,
674
+ hasXverse,
675
+ hasOyl,
676
+ hasMagicEden,
677
+ hasOkx,
678
+ hasLeather,
679
+ hasPhantom,
680
+ hasWizz
681
+ ]);
663
682
  (0, import_react.useEffect)(() => {
664
683
  setBalance(void 0);
665
684
  }, [network]);
@@ -1730,6 +1749,7 @@ var LaserEyesProvider = ({
1730
1749
  provider,
1731
1750
  balance,
1732
1751
  network,
1752
+ isInitializing,
1733
1753
  connected,
1734
1754
  isConnecting,
1735
1755
  hasUnisat,
package/dist/index.mjs CHANGED
@@ -203,6 +203,7 @@ var initialWalletContext = {
203
203
  hasLeather: false,
204
204
  hasPhantom: false,
205
205
  hasWizz: false,
206
+ isInitializing: true,
206
207
  connected: false,
207
208
  isConnecting: false,
208
209
  publicKey: "",
@@ -436,6 +437,7 @@ var LaserEyesProvider = ({
436
437
  const self = selfRef.current;
437
438
  const [library, setLibrary] = useState(null);
438
439
  const [provider, setProvider] = useState();
440
+ const [isInitializing, setIsInitializing] = useState(true);
439
441
  const [connected, setConnected] = useState(false);
440
442
  const [isConnecting, setIsConnecting] = useState(false);
441
443
  const [accounts, setAccounts] = useState([]);
@@ -467,6 +469,11 @@ var LaserEyesProvider = ({
467
469
  });
468
470
  }
469
471
  }, [config, library]);
472
+ const checkInitializationComplete = () => {
473
+ if (hasUnisat !== void 0 && hasXverse !== void 0 && hasOyl !== void 0 && hasMagicEden !== void 0 && hasOkx !== void 0 && hasLeather !== void 0 && hasPhantom !== void 0 && hasWizz !== void 0) {
474
+ setIsInitializing(false);
475
+ }
476
+ };
470
477
  useEffect(() => {
471
478
  const observer = new MutationObserver(() => {
472
479
  const unisatLib = window == null ? void 0 : window.unisat;
@@ -582,6 +589,18 @@ var LaserEyesProvider = ({
582
589
  observer.disconnect();
583
590
  };
584
591
  }, []);
592
+ useEffect(() => {
593
+ checkInitializationComplete();
594
+ }, [
595
+ hasUnisat,
596
+ hasXverse,
597
+ hasOyl,
598
+ hasMagicEden,
599
+ hasOkx,
600
+ hasLeather,
601
+ hasPhantom,
602
+ hasWizz
603
+ ]);
585
604
  useEffect(() => {
586
605
  setBalance(void 0);
587
606
  }, [network]);
@@ -1652,6 +1671,7 @@ var LaserEyesProvider = ({
1652
1671
  provider,
1653
1672
  balance,
1654
1673
  network,
1674
+ isInitializing,
1655
1675
  connected,
1656
1676
  isConnecting,
1657
1677
  hasUnisat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnisat/lasereyes",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "sideEffects": false,
5
5
  "private": false,
6
6
  "license": "MIT",