@omnisat/lasereyes 0.0.62 → 0.0.64

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.js CHANGED
@@ -793,6 +793,21 @@ var LaserEyesProvider = ({
793
793
  (0, import_react.useEffect)(() => {
794
794
  setBalance(void 0);
795
795
  }, [network]);
796
+ (0, import_react.useEffect)(() => {
797
+ if (provider !== UNISAT && provider !== WIZZ && !library) {
798
+ return;
799
+ }
800
+ const lib = window.unisat;
801
+ lib.getAccounts().then((accounts2) => {
802
+ handleAccountsChanged(accounts2);
803
+ });
804
+ lib.on("accountsChanged", handleAccountsChanged);
805
+ lib.on("networkChanged", handleNetworkChanged);
806
+ return () => {
807
+ lib.removeListener("accountsChanged", handleAccountsChanged);
808
+ lib.removeListener("networkChanged", handleNetworkChanged);
809
+ };
810
+ }, [provider, address2]);
796
811
  (0, import_react.useEffect)(() => {
797
812
  if (!isInitializing) {
798
813
  const defaultWallet = localStorage == null ? void 0 : localStorage.getItem(
@@ -1382,7 +1397,8 @@ var LaserEyesProvider = ({
1382
1397
  if (!library)
1383
1398
  return;
1384
1399
  if (provider === UNISAT) {
1385
- const bal = yield library.getBalance();
1400
+ const lib = window.unisat;
1401
+ const bal = yield lib.getBalance();
1386
1402
  setBalance(bal.total);
1387
1403
  return bal.total;
1388
1404
  } else if (provider === XVERSE) {
package/dist/index.mjs CHANGED
@@ -698,6 +698,21 @@ var LaserEyesProvider = ({
698
698
  useEffect(() => {
699
699
  setBalance(void 0);
700
700
  }, [network]);
701
+ useEffect(() => {
702
+ if (provider !== UNISAT && provider !== WIZZ && !library) {
703
+ return;
704
+ }
705
+ const lib = window.unisat;
706
+ lib.getAccounts().then((accounts2) => {
707
+ handleAccountsChanged(accounts2);
708
+ });
709
+ lib.on("accountsChanged", handleAccountsChanged);
710
+ lib.on("networkChanged", handleNetworkChanged);
711
+ return () => {
712
+ lib.removeListener("accountsChanged", handleAccountsChanged);
713
+ lib.removeListener("networkChanged", handleNetworkChanged);
714
+ };
715
+ }, [provider, address2]);
701
716
  useEffect(() => {
702
717
  if (!isInitializing) {
703
718
  const defaultWallet = localStorage == null ? void 0 : localStorage.getItem(
@@ -1287,7 +1302,8 @@ var LaserEyesProvider = ({
1287
1302
  if (!library)
1288
1303
  return;
1289
1304
  if (provider === UNISAT) {
1290
- const bal = yield library.getBalance();
1305
+ const lib = window.unisat;
1306
+ const bal = yield lib.getBalance();
1291
1307
  setBalance(bal.total);
1292
1308
  return bal.total;
1293
1309
  } else if (provider === XVERSE) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnisat/lasereyes",
3
- "version": "0.0.62",
3
+ "version": "0.0.64",
4
4
  "sideEffects": false,
5
5
  "private": false,
6
6
  "license": "MIT",