@omnisat/lasereyes 0.0.57 → 0.0.58

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
@@ -643,7 +643,7 @@ var LaserEyesProvider = ({
643
643
  const [hasWizz, setHasWizz] = (0, import_react.useState)(false);
644
644
  const [network, setNetwork] = (0, import_usehooks_ts.useLocalStorage)("network", (config == null ? void 0 : config.network) || MAINNET);
645
645
  (0, import_react.useEffect)(() => {
646
- if (config && config.network) {
646
+ if (config && config.network && library) {
647
647
  setNetwork(config.network);
648
648
  getNetwork().then((foundNetwork) => {
649
649
  try {
@@ -655,7 +655,7 @@ var LaserEyesProvider = ({
655
655
  }
656
656
  });
657
657
  }
658
- }, [config]);
658
+ }, [config, library]);
659
659
  const checkInitializationComplete = () => {
660
660
  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) {
661
661
  setIsInitializing(false);
@@ -1255,7 +1255,8 @@ var LaserEyesProvider = ({
1255
1255
  var _a, _b;
1256
1256
  try {
1257
1257
  if (provider === UNISAT) {
1258
- const unisatNetwork = yield library == null ? void 0 : library.getChain();
1258
+ const lib = window.unisat;
1259
+ const unisatNetwork = yield lib == null ? void 0 : lib.getChain();
1259
1260
  if (!unisatNetwork) {
1260
1261
  return (_a = config == null ? void 0 : config.network) != null ? _a : MAINNET;
1261
1262
  }
@@ -1331,9 +1332,10 @@ var LaserEyesProvider = ({
1331
1332
  if (!library)
1332
1333
  return;
1333
1334
  if (provider === UNISAT) {
1335
+ const lib = window.unisat;
1334
1336
  const wantedNetwork = getUnisatNetwork(network2);
1335
1337
  console.log("wantedNetwork", wantedNetwork);
1336
- yield library == null ? void 0 : library.switchChain(wantedNetwork);
1338
+ yield lib == null ? void 0 : lib.switchChain(wantedNetwork);
1337
1339
  setNetwork(network2);
1338
1340
  yield getBalance();
1339
1341
  } else if (provider === WIZZ) {
package/dist/index.mjs CHANGED
@@ -548,7 +548,7 @@ var LaserEyesProvider = ({
548
548
  const [hasWizz, setHasWizz] = useState(false);
549
549
  const [network, setNetwork] = useLocalStorage("network", (config == null ? void 0 : config.network) || MAINNET);
550
550
  useEffect(() => {
551
- if (config && config.network) {
551
+ if (config && config.network && library) {
552
552
  setNetwork(config.network);
553
553
  getNetwork().then((foundNetwork) => {
554
554
  try {
@@ -560,7 +560,7 @@ var LaserEyesProvider = ({
560
560
  }
561
561
  });
562
562
  }
563
- }, [config]);
563
+ }, [config, library]);
564
564
  const checkInitializationComplete = () => {
565
565
  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) {
566
566
  setIsInitializing(false);
@@ -1160,7 +1160,8 @@ var LaserEyesProvider = ({
1160
1160
  var _a, _b;
1161
1161
  try {
1162
1162
  if (provider === UNISAT) {
1163
- const unisatNetwork = yield library == null ? void 0 : library.getChain();
1163
+ const lib = window.unisat;
1164
+ const unisatNetwork = yield lib == null ? void 0 : lib.getChain();
1164
1165
  if (!unisatNetwork) {
1165
1166
  return (_a = config == null ? void 0 : config.network) != null ? _a : MAINNET;
1166
1167
  }
@@ -1236,9 +1237,10 @@ var LaserEyesProvider = ({
1236
1237
  if (!library)
1237
1238
  return;
1238
1239
  if (provider === UNISAT) {
1240
+ const lib = window.unisat;
1239
1241
  const wantedNetwork = getUnisatNetwork(network2);
1240
1242
  console.log("wantedNetwork", wantedNetwork);
1241
- yield library == null ? void 0 : library.switchChain(wantedNetwork);
1243
+ yield lib == null ? void 0 : lib.switchChain(wantedNetwork);
1242
1244
  setNetwork(network2);
1243
1245
  yield getBalance();
1244
1246
  } else if (provider === WIZZ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnisat/lasereyes",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "sideEffects": false,
5
5
  "private": false,
6
6
  "license": "MIT",