@omnisat/lasereyes 0.0.16 → 0.0.17

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
@@ -124,6 +124,13 @@ interface BlockchainInfoUTXO {
124
124
  confirmations: number;
125
125
  tx_index: number;
126
126
  }
127
+ interface CommitPsbtResponse {
128
+ inscriberAddress: string;
129
+ psbtHex: string;
130
+ psbtBase64: string;
131
+ feeRate: number;
132
+ totalFees: number;
133
+ }
127
134
 
128
135
  declare const createConfig: (config: Config) => Config;
129
136
 
@@ -165,11 +172,11 @@ declare const useInscriber: ({ inscribeApiUrl, }: {
165
172
  setMimeType: react.Dispatch<react.SetStateAction<"text/plain;charset=utf-8">>;
166
173
  previewUrl: string;
167
174
  setPreviewUrl: react.Dispatch<react.SetStateAction<string>>;
168
- getCommitPsbt: () => Promise<void>;
175
+ getCommitPsbt: () => Promise<CommitPsbtResponse>;
169
176
  isFetchingCommitPsbt: boolean;
170
177
  commitPsbtHex: string;
171
178
  commitPsbtBase64: string;
172
- handleSignCommit: () => Promise<string | undefined>;
179
+ handleSignCommit: (tx: string) => Promise<string | undefined>;
173
180
  commitTxId: string;
174
181
  setCommitTxId: react.Dispatch<react.SetStateAction<string>>;
175
182
  feeRate: number;
package/dist/index.js CHANGED
@@ -1776,6 +1776,7 @@ var useInscriber = ({
1776
1776
  setFeeRate(feeRate);
1777
1777
  setTotalFees(data.totalFees);
1778
1778
  setInscriberAddress(data.inscriberAddress);
1779
+ return data;
1779
1780
  });
1780
1781
  } catch (e) {
1781
1782
  console.error(e);
@@ -1784,9 +1785,9 @@ var useInscriber = ({
1784
1785
  setIsFetchingCommitPsbt(false);
1785
1786
  }
1786
1787
  }), [paymentAddress, paymentPublicKey, content, feeRate, mimeType, publicKey]);
1787
- const handleSignCommit = () => __async(void 0, null, function* () {
1788
+ const handleSignCommit = (tx) => __async(void 0, null, function* () {
1788
1789
  try {
1789
- const signedResponse = yield signPsbt(commitPsbtHex, true, true);
1790
+ const signedResponse = yield signPsbt(tx, true, true);
1790
1791
  setCommitTxId(signedResponse == null ? void 0 : signedResponse.txId);
1791
1792
  return signedResponse == null ? void 0 : signedResponse.txId;
1792
1793
  } catch (e) {
@@ -1796,6 +1797,7 @@ var useInscriber = ({
1796
1797
  });
1797
1798
  const inscribe = (0, import_react2.useCallback)(() => __async(void 0, null, function* () {
1798
1799
  try {
1800
+ setIsInscribing(true);
1799
1801
  if (!content)
1800
1802
  throw new Error("missing content");
1801
1803
  if (!address2)
@@ -1803,10 +1805,11 @@ var useInscriber = ({
1803
1805
  if (!mimeType)
1804
1806
  throw new Error("missing mimeType");
1805
1807
  if (!commitTxId) {
1806
- yield getCommitPsbt();
1807
- yield handleSignCommit();
1808
+ console.log("commitTxId not found, getting commit psbt");
1809
+ const signed = yield getCommitPsbt();
1810
+ console.log({ signed });
1811
+ yield handleSignCommit(signed.psbtBase64);
1808
1812
  }
1809
- setIsInscribing(true);
1810
1813
  yield delay(1e4);
1811
1814
  return yield import_axios3.default.post(`${inscribeApiUrl}/inscribe`, {
1812
1815
  content,
package/dist/index.mjs CHANGED
@@ -1698,6 +1698,7 @@ var useInscriber = ({
1698
1698
  setFeeRate(feeRate);
1699
1699
  setTotalFees(data.totalFees);
1700
1700
  setInscriberAddress(data.inscriberAddress);
1701
+ return data;
1701
1702
  });
1702
1703
  } catch (e) {
1703
1704
  console.error(e);
@@ -1706,9 +1707,9 @@ var useInscriber = ({
1706
1707
  setIsFetchingCommitPsbt(false);
1707
1708
  }
1708
1709
  }), [paymentAddress, paymentPublicKey, content, feeRate, mimeType, publicKey]);
1709
- const handleSignCommit = () => __async(void 0, null, function* () {
1710
+ const handleSignCommit = (tx) => __async(void 0, null, function* () {
1710
1711
  try {
1711
- const signedResponse = yield signPsbt(commitPsbtHex, true, true);
1712
+ const signedResponse = yield signPsbt(tx, true, true);
1712
1713
  setCommitTxId(signedResponse == null ? void 0 : signedResponse.txId);
1713
1714
  return signedResponse == null ? void 0 : signedResponse.txId;
1714
1715
  } catch (e) {
@@ -1718,6 +1719,7 @@ var useInscriber = ({
1718
1719
  });
1719
1720
  const inscribe = useCallback(() => __async(void 0, null, function* () {
1720
1721
  try {
1722
+ setIsInscribing(true);
1721
1723
  if (!content)
1722
1724
  throw new Error("missing content");
1723
1725
  if (!address2)
@@ -1725,10 +1727,11 @@ var useInscriber = ({
1725
1727
  if (!mimeType)
1726
1728
  throw new Error("missing mimeType");
1727
1729
  if (!commitTxId) {
1728
- yield getCommitPsbt();
1729
- yield handleSignCommit();
1730
+ console.log("commitTxId not found, getting commit psbt");
1731
+ const signed = yield getCommitPsbt();
1732
+ console.log({ signed });
1733
+ yield handleSignCommit(signed.psbtBase64);
1730
1734
  }
1731
- setIsInscribing(true);
1732
1735
  yield delay(1e4);
1733
1736
  return yield axios3.post(`${inscribeApiUrl}/inscribe`, {
1734
1737
  content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnisat/lasereyes",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "sideEffects": false,
5
5
  "private": false,
6
6
  "license": "MIT",