@omnisat/lasereyes 0.0.78 → 0.0.80

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
@@ -1027,7 +1027,6 @@ var LaserEyesProvider = ({
1027
1027
  setPublicKey(okxAccounts.publicKey);
1028
1028
  setPaymentPublicKey(okxAccounts.publicKey);
1029
1029
  setLibrary(lib);
1030
- console.log("lib", lib);
1031
1030
  setProvider(OKX);
1032
1031
  setConnected(true);
1033
1032
  const balance2 = yield lib == null ? void 0 : lib.getBalance();
@@ -1638,12 +1637,18 @@ var LaserEyesProvider = ({
1638
1637
  throw new Error("Error sending BTC");
1639
1638
  return sendResponse.txid;
1640
1639
  } else if (provider === OKX) {
1641
- const txId = yield library == null ? void 0 : library.sendBitcoin(to, amount);
1640
+ const lib = getOkxLibrary();
1641
+ setLibrary(lib);
1642
+ const txId = yield lib == null ? void 0 : lib.sendBitcoin(to, amount);
1642
1643
  if (!txId)
1643
1644
  throw new Error("Transaction failed");
1644
1645
  return txId;
1645
1646
  } else if (provider === LEATHER) {
1646
- const response = yield library == null ? void 0 : library.request("sendTransfer", {
1647
+ const lib = window.LeatherProvider;
1648
+ if (!lib)
1649
+ throw new Error("Library not found");
1650
+ setLibrary(lib);
1651
+ const response = yield lib == null ? void 0 : lib.request("sendTransfer", {
1647
1652
  recipients: [
1648
1653
  {
1649
1654
  address: to,
@@ -1759,11 +1764,13 @@ var LaserEyesProvider = ({
1759
1764
  const lib = getOkxLibrary();
1760
1765
  return yield lib == null ? void 0 : lib.signMessage(message);
1761
1766
  } else if (provider === LEATHER) {
1767
+ const lib = window.LeatherProvider;
1768
+ setLibrary(lib);
1762
1769
  const paymentType = toSignAddress === address2 ? P2TR : P2WPKH;
1763
1770
  if (toSignAddress !== address2 && toSignAddress !== paymentAddress) {
1764
1771
  throw new Error("Invalid address to sign message");
1765
1772
  }
1766
- const signed = yield library == null ? void 0 : library.request("signMessage", {
1773
+ const signed = yield lib == null ? void 0 : lib.request("signMessage", {
1767
1774
  message,
1768
1775
  paymentType
1769
1776
  });
@@ -2061,7 +2068,9 @@ var LaserEyesProvider = ({
2061
2068
  broadcast: false,
2062
2069
  network
2063
2070
  };
2064
- const response = yield library == null ? void 0 : library.request(
2071
+ const lib = window.LeatherProvider;
2072
+ setLibrary(lib);
2073
+ const response = yield lib == null ? void 0 : lib.request(
2065
2074
  "signPsbt",
2066
2075
  requestParams
2067
2076
  );
package/dist/index.mjs CHANGED
@@ -928,7 +928,6 @@ var LaserEyesProvider = ({
928
928
  setPublicKey(okxAccounts.publicKey);
929
929
  setPaymentPublicKey(okxAccounts.publicKey);
930
930
  setLibrary(lib);
931
- console.log("lib", lib);
932
931
  setProvider(OKX);
933
932
  setConnected(true);
934
933
  const balance2 = yield lib == null ? void 0 : lib.getBalance();
@@ -1539,12 +1538,18 @@ var LaserEyesProvider = ({
1539
1538
  throw new Error("Error sending BTC");
1540
1539
  return sendResponse.txid;
1541
1540
  } else if (provider === OKX) {
1542
- const txId = yield library == null ? void 0 : library.sendBitcoin(to, amount);
1541
+ const lib = getOkxLibrary();
1542
+ setLibrary(lib);
1543
+ const txId = yield lib == null ? void 0 : lib.sendBitcoin(to, amount);
1543
1544
  if (!txId)
1544
1545
  throw new Error("Transaction failed");
1545
1546
  return txId;
1546
1547
  } else if (provider === LEATHER) {
1547
- const response = yield library == null ? void 0 : library.request("sendTransfer", {
1548
+ const lib = window.LeatherProvider;
1549
+ if (!lib)
1550
+ throw new Error("Library not found");
1551
+ setLibrary(lib);
1552
+ const response = yield lib == null ? void 0 : lib.request("sendTransfer", {
1548
1553
  recipients: [
1549
1554
  {
1550
1555
  address: to,
@@ -1660,11 +1665,13 @@ var LaserEyesProvider = ({
1660
1665
  const lib = getOkxLibrary();
1661
1666
  return yield lib == null ? void 0 : lib.signMessage(message);
1662
1667
  } else if (provider === LEATHER) {
1668
+ const lib = window.LeatherProvider;
1669
+ setLibrary(lib);
1663
1670
  const paymentType = toSignAddress === address2 ? P2TR : P2WPKH;
1664
1671
  if (toSignAddress !== address2 && toSignAddress !== paymentAddress) {
1665
1672
  throw new Error("Invalid address to sign message");
1666
1673
  }
1667
- const signed = yield library == null ? void 0 : library.request("signMessage", {
1674
+ const signed = yield lib == null ? void 0 : lib.request("signMessage", {
1668
1675
  message,
1669
1676
  paymentType
1670
1677
  });
@@ -1962,7 +1969,9 @@ var LaserEyesProvider = ({
1962
1969
  broadcast: false,
1963
1970
  network
1964
1971
  };
1965
- const response = yield library == null ? void 0 : library.request(
1972
+ const lib = window.LeatherProvider;
1973
+ setLibrary(lib);
1974
+ const response = yield lib == null ? void 0 : lib.request(
1966
1975
  "signPsbt",
1967
1976
  requestParams
1968
1977
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnisat/lasereyes",
3
- "version": "0.0.78",
3
+ "version": "0.0.80",
4
4
  "sideEffects": false,
5
5
  "private": false,
6
6
  "license": "MIT",