@omnisat/lasereyes 0.0.63 → 0.0.65
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 +32 -9
- package/dist/index.mjs +32 -9
- package/package.json +1 -1
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 = provider === WIZZ ? window.wizz : 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(
|
|
@@ -1245,7 +1260,8 @@ var LaserEyesProvider = ({
|
|
|
1245
1260
|
);
|
|
1246
1261
|
return phantomAccountsParsed;
|
|
1247
1262
|
} else if (provider === WIZZ) {
|
|
1248
|
-
|
|
1263
|
+
const lib = window.wizz;
|
|
1264
|
+
return yield lib.requestAccounts();
|
|
1249
1265
|
} else {
|
|
1250
1266
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1251
1267
|
}
|
|
@@ -1321,7 +1337,8 @@ var LaserEyesProvider = ({
|
|
|
1321
1337
|
}
|
|
1322
1338
|
return MAINNET;
|
|
1323
1339
|
} else if (provider === WIZZ) {
|
|
1324
|
-
const
|
|
1340
|
+
const lib = window.wizz;
|
|
1341
|
+
const wizzNetwork = yield lib == null ? void 0 : lib.getNetwork();
|
|
1325
1342
|
return getNetworkForWizz(wizzNetwork);
|
|
1326
1343
|
}
|
|
1327
1344
|
return (_b = config == null ? void 0 : config.network) != null ? _b : MAINNET;
|
|
@@ -1341,11 +1358,12 @@ var LaserEyesProvider = ({
|
|
|
1341
1358
|
setNetwork(network2);
|
|
1342
1359
|
yield getBalance();
|
|
1343
1360
|
} else if (provider === WIZZ) {
|
|
1361
|
+
const lib = window.wizz;
|
|
1344
1362
|
if (network2 === FRACTAL_TESTNET || network2 === FRACTAL_MAINNET) {
|
|
1345
|
-
return yield
|
|
1363
|
+
return yield lib.switchNetwork(WIZZ_MAINNET);
|
|
1346
1364
|
}
|
|
1347
1365
|
const wantedNetwork = getNetworkForWizz(network2);
|
|
1348
|
-
yield
|
|
1366
|
+
yield lib == null ? void 0 : lib.switchNetwork(wantedNetwork);
|
|
1349
1367
|
setNetwork(network2);
|
|
1350
1368
|
yield getBalance();
|
|
1351
1369
|
} else {
|
|
@@ -1369,7 +1387,8 @@ var LaserEyesProvider = ({
|
|
|
1369
1387
|
} else if (provider === OKX) {
|
|
1370
1388
|
return yield library == null ? void 0 : library.getPublicKey();
|
|
1371
1389
|
} else if (provider === WIZZ) {
|
|
1372
|
-
|
|
1390
|
+
const lib = window.wizz;
|
|
1391
|
+
return yield lib == null ? void 0 : lib.getPublicKey();
|
|
1373
1392
|
} else {
|
|
1374
1393
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1375
1394
|
}
|
|
@@ -1412,7 +1431,8 @@ var LaserEyesProvider = ({
|
|
|
1412
1431
|
setBalance(bal);
|
|
1413
1432
|
return bal;
|
|
1414
1433
|
} else if (provider === WIZZ) {
|
|
1415
|
-
const
|
|
1434
|
+
const lib = window.wizz;
|
|
1435
|
+
const balanceResponse = yield lib.getBalance();
|
|
1416
1436
|
const bal = balanceResponse.total;
|
|
1417
1437
|
setBalance(bal);
|
|
1418
1438
|
return bal;
|
|
@@ -1432,7 +1452,8 @@ var LaserEyesProvider = ({
|
|
|
1432
1452
|
} else if (provider === OKX) {
|
|
1433
1453
|
return yield library.getInscriptions(0, 10);
|
|
1434
1454
|
} else if (provider === WIZZ) {
|
|
1435
|
-
|
|
1455
|
+
const lib = window.wizz;
|
|
1456
|
+
return yield lib.getInscriptions(0, 10);
|
|
1436
1457
|
} else {
|
|
1437
1458
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1438
1459
|
}
|
|
@@ -1619,7 +1640,8 @@ var LaserEyesProvider = ({
|
|
|
1619
1640
|
const binaryString = String.fromCharCode(...response.signature);
|
|
1620
1641
|
return btoa(binaryString);
|
|
1621
1642
|
} else if (provider === WIZZ) {
|
|
1622
|
-
|
|
1643
|
+
const lib = window.wizz;
|
|
1644
|
+
return yield lib == null ? void 0 : lib.signMessage(message);
|
|
1623
1645
|
} else {
|
|
1624
1646
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1625
1647
|
}
|
|
@@ -1919,7 +1941,8 @@ var LaserEyesProvider = ({
|
|
|
1919
1941
|
};
|
|
1920
1942
|
}
|
|
1921
1943
|
} else if (provider === WIZZ) {
|
|
1922
|
-
const
|
|
1944
|
+
const lib = window.wizz;
|
|
1945
|
+
const signedPsbt = yield lib == null ? void 0 : lib.signPsbt(psbtHex, {
|
|
1923
1946
|
autoFinalized: finalize,
|
|
1924
1947
|
broadcast: false
|
|
1925
1948
|
});
|
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 = provider === WIZZ ? window.wizz : 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(
|
|
@@ -1150,7 +1165,8 @@ var LaserEyesProvider = ({
|
|
|
1150
1165
|
);
|
|
1151
1166
|
return phantomAccountsParsed;
|
|
1152
1167
|
} else if (provider === WIZZ) {
|
|
1153
|
-
|
|
1168
|
+
const lib = window.wizz;
|
|
1169
|
+
return yield lib.requestAccounts();
|
|
1154
1170
|
} else {
|
|
1155
1171
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1156
1172
|
}
|
|
@@ -1226,7 +1242,8 @@ var LaserEyesProvider = ({
|
|
|
1226
1242
|
}
|
|
1227
1243
|
return MAINNET;
|
|
1228
1244
|
} else if (provider === WIZZ) {
|
|
1229
|
-
const
|
|
1245
|
+
const lib = window.wizz;
|
|
1246
|
+
const wizzNetwork = yield lib == null ? void 0 : lib.getNetwork();
|
|
1230
1247
|
return getNetworkForWizz(wizzNetwork);
|
|
1231
1248
|
}
|
|
1232
1249
|
return (_b = config == null ? void 0 : config.network) != null ? _b : MAINNET;
|
|
@@ -1246,11 +1263,12 @@ var LaserEyesProvider = ({
|
|
|
1246
1263
|
setNetwork(network2);
|
|
1247
1264
|
yield getBalance();
|
|
1248
1265
|
} else if (provider === WIZZ) {
|
|
1266
|
+
const lib = window.wizz;
|
|
1249
1267
|
if (network2 === FRACTAL_TESTNET || network2 === FRACTAL_MAINNET) {
|
|
1250
|
-
return yield
|
|
1268
|
+
return yield lib.switchNetwork(WIZZ_MAINNET);
|
|
1251
1269
|
}
|
|
1252
1270
|
const wantedNetwork = getNetworkForWizz(network2);
|
|
1253
|
-
yield
|
|
1271
|
+
yield lib == null ? void 0 : lib.switchNetwork(wantedNetwork);
|
|
1254
1272
|
setNetwork(network2);
|
|
1255
1273
|
yield getBalance();
|
|
1256
1274
|
} else {
|
|
@@ -1274,7 +1292,8 @@ var LaserEyesProvider = ({
|
|
|
1274
1292
|
} else if (provider === OKX) {
|
|
1275
1293
|
return yield library == null ? void 0 : library.getPublicKey();
|
|
1276
1294
|
} else if (provider === WIZZ) {
|
|
1277
|
-
|
|
1295
|
+
const lib = window.wizz;
|
|
1296
|
+
return yield lib == null ? void 0 : lib.getPublicKey();
|
|
1278
1297
|
} else {
|
|
1279
1298
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1280
1299
|
}
|
|
@@ -1317,7 +1336,8 @@ var LaserEyesProvider = ({
|
|
|
1317
1336
|
setBalance(bal);
|
|
1318
1337
|
return bal;
|
|
1319
1338
|
} else if (provider === WIZZ) {
|
|
1320
|
-
const
|
|
1339
|
+
const lib = window.wizz;
|
|
1340
|
+
const balanceResponse = yield lib.getBalance();
|
|
1321
1341
|
const bal = balanceResponse.total;
|
|
1322
1342
|
setBalance(bal);
|
|
1323
1343
|
return bal;
|
|
@@ -1337,7 +1357,8 @@ var LaserEyesProvider = ({
|
|
|
1337
1357
|
} else if (provider === OKX) {
|
|
1338
1358
|
return yield library.getInscriptions(0, 10);
|
|
1339
1359
|
} else if (provider === WIZZ) {
|
|
1340
|
-
|
|
1360
|
+
const lib = window.wizz;
|
|
1361
|
+
return yield lib.getInscriptions(0, 10);
|
|
1341
1362
|
} else {
|
|
1342
1363
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1343
1364
|
}
|
|
@@ -1524,7 +1545,8 @@ var LaserEyesProvider = ({
|
|
|
1524
1545
|
const binaryString = String.fromCharCode(...response.signature);
|
|
1525
1546
|
return btoa(binaryString);
|
|
1526
1547
|
} else if (provider === WIZZ) {
|
|
1527
|
-
|
|
1548
|
+
const lib = window.wizz;
|
|
1549
|
+
return yield lib == null ? void 0 : lib.signMessage(message);
|
|
1528
1550
|
} else {
|
|
1529
1551
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1530
1552
|
}
|
|
@@ -1824,7 +1846,8 @@ var LaserEyesProvider = ({
|
|
|
1824
1846
|
};
|
|
1825
1847
|
}
|
|
1826
1848
|
} else if (provider === WIZZ) {
|
|
1827
|
-
const
|
|
1849
|
+
const lib = window.wizz;
|
|
1850
|
+
const signedPsbt = yield lib == null ? void 0 : lib.signPsbt(psbtHex, {
|
|
1828
1851
|
autoFinalized: finalize,
|
|
1829
1852
|
broadcast: false
|
|
1830
1853
|
});
|