@omnisat/lasereyes 0.0.67 → 0.0.70
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 +36 -34
- package/dist/index.mjs +36 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -899,19 +899,17 @@ var LaserEyesProvider = ({
|
|
|
899
899
|
try {
|
|
900
900
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, OYL);
|
|
901
901
|
const lib = window.oyl;
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
setPaymentAddress(
|
|
902
|
+
console.log({ lib });
|
|
903
|
+
const { nativeSegwit, taproot } = yield lib.getAddresses();
|
|
904
|
+
setAddress(taproot.address);
|
|
905
|
+
setPublicKey(taproot.publicKey);
|
|
906
|
+
setPaymentPublicKey(nativeSegwit.publicKey);
|
|
907
|
+
setPaymentAddress(nativeSegwit.address);
|
|
908
908
|
setLibrary(lib);
|
|
909
909
|
setProvider(OYL);
|
|
910
|
-
handleAccountsChanged(result);
|
|
911
910
|
setConnected(true);
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
});
|
|
911
|
+
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
912
|
+
setBalance(balance2 == null ? void 0 : balance2.total);
|
|
915
913
|
} catch (error) {
|
|
916
914
|
throw new Error(`Can't lasereyes to ${OYL} wallet`);
|
|
917
915
|
}
|
|
@@ -1187,7 +1185,8 @@ var LaserEyesProvider = ({
|
|
|
1187
1185
|
if (!library)
|
|
1188
1186
|
throw new Error("No wallet connected");
|
|
1189
1187
|
if (provider === UNISAT) {
|
|
1190
|
-
|
|
1188
|
+
const lib = window.unisat;
|
|
1189
|
+
return yield lib.requestAccounts();
|
|
1191
1190
|
} else if (provider === XVERSE) {
|
|
1192
1191
|
const getAddressOptions = {
|
|
1193
1192
|
payload: {
|
|
@@ -1412,10 +1411,10 @@ var LaserEyesProvider = ({
|
|
|
1412
1411
|
setBalance(bal);
|
|
1413
1412
|
return bal;
|
|
1414
1413
|
} else if (provider === OYL) {
|
|
1415
|
-
const
|
|
1416
|
-
const bal =
|
|
1417
|
-
setBalance(bal);
|
|
1418
|
-
return bal;
|
|
1414
|
+
const lib = window == null ? void 0 : window.oyl;
|
|
1415
|
+
const bal = yield lib.getBalance();
|
|
1416
|
+
setBalance(bal.total);
|
|
1417
|
+
return bal.total;
|
|
1419
1418
|
} else if (provider === MAGIC_EDEN) {
|
|
1420
1419
|
const bal = yield getBTCBalance(paymentAddress, network);
|
|
1421
1420
|
setBalance(bal);
|
|
@@ -1497,7 +1496,7 @@ var LaserEyesProvider = ({
|
|
|
1497
1496
|
}
|
|
1498
1497
|
}
|
|
1499
1498
|
} else if (provider === OYL) {
|
|
1500
|
-
const { psbtHex
|
|
1499
|
+
const { psbtHex } = yield createSendBtcPsbt(
|
|
1501
1500
|
address2,
|
|
1502
1501
|
paymentAddress,
|
|
1503
1502
|
to,
|
|
@@ -1600,8 +1599,13 @@ var LaserEyesProvider = ({
|
|
|
1600
1599
|
}
|
|
1601
1600
|
}
|
|
1602
1601
|
} else if (provider === OYL) {
|
|
1602
|
+
const lib = window == null ? void 0 : window.oyl;
|
|
1603
1603
|
const tempAddy = toSignAddress || paymentAddress;
|
|
1604
|
-
|
|
1604
|
+
const response = yield lib == null ? void 0 : lib.signMessage({
|
|
1605
|
+
address: tempAddy,
|
|
1606
|
+
message
|
|
1607
|
+
});
|
|
1608
|
+
return response.signature;
|
|
1605
1609
|
} else if (provider === MAGIC_EDEN) {
|
|
1606
1610
|
const tempAddy = toSignAddress || paymentAddress;
|
|
1607
1611
|
let signedMessage;
|
|
@@ -1775,22 +1779,18 @@ var LaserEyesProvider = ({
|
|
|
1775
1779
|
txId
|
|
1776
1780
|
};
|
|
1777
1781
|
} else if (provider === OYL) {
|
|
1778
|
-
const
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1791
|
-
txId: void 0
|
|
1792
|
-
};
|
|
1793
|
-
}
|
|
1782
|
+
const lib = window == null ? void 0 : window.oyl;
|
|
1783
|
+
const { psbt: psbt2, txid } = yield lib == null ? void 0 : lib.signPsbt({
|
|
1784
|
+
psbt: psbtHex,
|
|
1785
|
+
finalize,
|
|
1786
|
+
broadcast
|
|
1787
|
+
});
|
|
1788
|
+
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(psbt2);
|
|
1789
|
+
return {
|
|
1790
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
1791
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1792
|
+
txId: txid
|
|
1793
|
+
};
|
|
1794
1794
|
} else if (provider === MAGIC_EDEN) {
|
|
1795
1795
|
const toSignPsbt = bitcoin2.Psbt.fromBase64(String(psbtBase64), {
|
|
1796
1796
|
network: getBitcoinNetwork(network)
|
|
@@ -1978,7 +1978,9 @@ var LaserEyesProvider = ({
|
|
|
1978
1978
|
if (provider === UNISAT) {
|
|
1979
1979
|
return yield import_axios2.default.post(`${getMempoolSpaceUrl2(network)}/api/tx`, psbt).then((res) => res.data);
|
|
1980
1980
|
} else if (provider === OYL) {
|
|
1981
|
-
|
|
1981
|
+
const oylLib = window == null ? void 0 : window.oyl;
|
|
1982
|
+
const response = yield oylLib.pushPsbt({ psbt });
|
|
1983
|
+
return response.txid;
|
|
1982
1984
|
} else if (provider === OKX) {
|
|
1983
1985
|
return yield import_axios2.default.post(`${getMempoolSpaceUrl2(network)}/api/tx`, psbt).then((res) => res.data);
|
|
1984
1986
|
} else if (provider === MAGIC_EDEN) {
|
package/dist/index.mjs
CHANGED
|
@@ -804,19 +804,17 @@ var LaserEyesProvider = ({
|
|
|
804
804
|
try {
|
|
805
805
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, OYL);
|
|
806
806
|
const lib = window.oyl;
|
|
807
|
-
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
setPaymentAddress(
|
|
807
|
+
console.log({ lib });
|
|
808
|
+
const { nativeSegwit, taproot } = yield lib.getAddresses();
|
|
809
|
+
setAddress(taproot.address);
|
|
810
|
+
setPublicKey(taproot.publicKey);
|
|
811
|
+
setPaymentPublicKey(nativeSegwit.publicKey);
|
|
812
|
+
setPaymentAddress(nativeSegwit.address);
|
|
813
813
|
setLibrary(lib);
|
|
814
814
|
setProvider(OYL);
|
|
815
|
-
handleAccountsChanged(result);
|
|
816
815
|
setConnected(true);
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
});
|
|
816
|
+
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
817
|
+
setBalance(balance2 == null ? void 0 : balance2.total);
|
|
820
818
|
} catch (error) {
|
|
821
819
|
throw new Error(`Can't lasereyes to ${OYL} wallet`);
|
|
822
820
|
}
|
|
@@ -1092,7 +1090,8 @@ var LaserEyesProvider = ({
|
|
|
1092
1090
|
if (!library)
|
|
1093
1091
|
throw new Error("No wallet connected");
|
|
1094
1092
|
if (provider === UNISAT) {
|
|
1095
|
-
|
|
1093
|
+
const lib = window.unisat;
|
|
1094
|
+
return yield lib.requestAccounts();
|
|
1096
1095
|
} else if (provider === XVERSE) {
|
|
1097
1096
|
const getAddressOptions = {
|
|
1098
1097
|
payload: {
|
|
@@ -1317,10 +1316,10 @@ var LaserEyesProvider = ({
|
|
|
1317
1316
|
setBalance(bal);
|
|
1318
1317
|
return bal;
|
|
1319
1318
|
} else if (provider === OYL) {
|
|
1320
|
-
const
|
|
1321
|
-
const bal =
|
|
1322
|
-
setBalance(bal);
|
|
1323
|
-
return bal;
|
|
1319
|
+
const lib = window == null ? void 0 : window.oyl;
|
|
1320
|
+
const bal = yield lib.getBalance();
|
|
1321
|
+
setBalance(bal.total);
|
|
1322
|
+
return bal.total;
|
|
1324
1323
|
} else if (provider === MAGIC_EDEN) {
|
|
1325
1324
|
const bal = yield getBTCBalance(paymentAddress, network);
|
|
1326
1325
|
setBalance(bal);
|
|
@@ -1402,7 +1401,7 @@ var LaserEyesProvider = ({
|
|
|
1402
1401
|
}
|
|
1403
1402
|
}
|
|
1404
1403
|
} else if (provider === OYL) {
|
|
1405
|
-
const { psbtHex
|
|
1404
|
+
const { psbtHex } = yield createSendBtcPsbt(
|
|
1406
1405
|
address2,
|
|
1407
1406
|
paymentAddress,
|
|
1408
1407
|
to,
|
|
@@ -1505,8 +1504,13 @@ var LaserEyesProvider = ({
|
|
|
1505
1504
|
}
|
|
1506
1505
|
}
|
|
1507
1506
|
} else if (provider === OYL) {
|
|
1507
|
+
const lib = window == null ? void 0 : window.oyl;
|
|
1508
1508
|
const tempAddy = toSignAddress || paymentAddress;
|
|
1509
|
-
|
|
1509
|
+
const response = yield lib == null ? void 0 : lib.signMessage({
|
|
1510
|
+
address: tempAddy,
|
|
1511
|
+
message
|
|
1512
|
+
});
|
|
1513
|
+
return response.signature;
|
|
1510
1514
|
} else if (provider === MAGIC_EDEN) {
|
|
1511
1515
|
const tempAddy = toSignAddress || paymentAddress;
|
|
1512
1516
|
let signedMessage;
|
|
@@ -1680,22 +1684,18 @@ var LaserEyesProvider = ({
|
|
|
1680
1684
|
txId
|
|
1681
1685
|
};
|
|
1682
1686
|
} else if (provider === OYL) {
|
|
1683
|
-
const
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1696
|
-
txId: void 0
|
|
1697
|
-
};
|
|
1698
|
-
}
|
|
1687
|
+
const lib = window == null ? void 0 : window.oyl;
|
|
1688
|
+
const { psbt: psbt2, txid } = yield lib == null ? void 0 : lib.signPsbt({
|
|
1689
|
+
psbt: psbtHex,
|
|
1690
|
+
finalize,
|
|
1691
|
+
broadcast
|
|
1692
|
+
});
|
|
1693
|
+
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(psbt2);
|
|
1694
|
+
return {
|
|
1695
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
1696
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1697
|
+
txId: txid
|
|
1698
|
+
};
|
|
1699
1699
|
} else if (provider === MAGIC_EDEN) {
|
|
1700
1700
|
const toSignPsbt = bitcoin2.Psbt.fromBase64(String(psbtBase64), {
|
|
1701
1701
|
network: getBitcoinNetwork(network)
|
|
@@ -1883,7 +1883,9 @@ var LaserEyesProvider = ({
|
|
|
1883
1883
|
if (provider === UNISAT) {
|
|
1884
1884
|
return yield axios2.post(`${getMempoolSpaceUrl2(network)}/api/tx`, psbt).then((res) => res.data);
|
|
1885
1885
|
} else if (provider === OYL) {
|
|
1886
|
-
|
|
1886
|
+
const oylLib = window == null ? void 0 : window.oyl;
|
|
1887
|
+
const response = yield oylLib.pushPsbt({ psbt });
|
|
1888
|
+
return response.txid;
|
|
1887
1889
|
} else if (provider === OKX) {
|
|
1888
1890
|
return yield axios2.post(`${getMempoolSpaceUrl2(network)}/api/tx`, psbt).then((res) => res.data);
|
|
1889
1891
|
} else if (provider === MAGIC_EDEN) {
|