@omnisat/lasereyes 0.0.17 → 0.0.18

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.d.ts CHANGED
@@ -176,7 +176,7 @@ declare const useInscriber: ({ inscribeApiUrl, }: {
176
176
  isFetchingCommitPsbt: boolean;
177
177
  commitPsbtHex: string;
178
178
  commitPsbtBase64: string;
179
- handleSignCommit: (tx: string) => Promise<string | undefined>;
179
+ handleSignCommit: (tx?: string) => Promise<string | undefined>;
180
180
  commitTxId: string;
181
181
  setCommitTxId: react.Dispatch<react.SetStateAction<string>>;
182
182
  feeRate: number;
package/dist/index.js CHANGED
@@ -1355,6 +1355,8 @@ var LaserEyesProvider = ({
1355
1355
  let psbtHex, psbtBase64;
1356
1356
  if (!library)
1357
1357
  return;
1358
+ if (!psbt)
1359
+ throw new Error("No PSBT provided");
1358
1360
  if (isHex(psbt)) {
1359
1361
  psbtBase64 = bitcoin2.Psbt.fromHex(psbt).toBase64();
1360
1362
  psbtHex = psbt;
@@ -1787,7 +1789,10 @@ var useInscriber = ({
1787
1789
  }), [paymentAddress, paymentPublicKey, content, feeRate, mimeType, publicKey]);
1788
1790
  const handleSignCommit = (tx) => __async(void 0, null, function* () {
1789
1791
  try {
1790
- const signedResponse = yield signPsbt(tx, true, true);
1792
+ const toBeSigned = tx != null ? tx : commitPsbtHex;
1793
+ if (!toBeSigned)
1794
+ throw new Error("missing tx");
1795
+ const signedResponse = yield signPsbt(toBeSigned, true, true);
1791
1796
  setCommitTxId(signedResponse == null ? void 0 : signedResponse.txId);
1792
1797
  return signedResponse == null ? void 0 : signedResponse.txId;
1793
1798
  } catch (e) {
package/dist/index.mjs CHANGED
@@ -1277,6 +1277,8 @@ var LaserEyesProvider = ({
1277
1277
  let psbtHex, psbtBase64;
1278
1278
  if (!library)
1279
1279
  return;
1280
+ if (!psbt)
1281
+ throw new Error("No PSBT provided");
1280
1282
  if (isHex(psbt)) {
1281
1283
  psbtBase64 = bitcoin2.Psbt.fromHex(psbt).toBase64();
1282
1284
  psbtHex = psbt;
@@ -1709,7 +1711,10 @@ var useInscriber = ({
1709
1711
  }), [paymentAddress, paymentPublicKey, content, feeRate, mimeType, publicKey]);
1710
1712
  const handleSignCommit = (tx) => __async(void 0, null, function* () {
1711
1713
  try {
1712
- const signedResponse = yield signPsbt(tx, true, true);
1714
+ const toBeSigned = tx != null ? tx : commitPsbtHex;
1715
+ if (!toBeSigned)
1716
+ throw new Error("missing tx");
1717
+ const signedResponse = yield signPsbt(toBeSigned, true, true);
1713
1718
  setCommitTxId(signedResponse == null ? void 0 : signedResponse.txId);
1714
1719
  return signedResponse == null ? void 0 : signedResponse.txId;
1715
1720
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnisat/lasereyes",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "sideEffects": false,
5
5
  "private": false,
6
6
  "license": "MIT",