@omnisat/lasereyes 0.0.16 → 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 +9 -2
- package/dist/index.js +13 -5
- package/dist/index.mjs +13 -5
- package/package.json +1 -1
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<
|
|
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
|
@@ -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;
|
|
@@ -1776,6 +1778,7 @@ var useInscriber = ({
|
|
|
1776
1778
|
setFeeRate(feeRate);
|
|
1777
1779
|
setTotalFees(data.totalFees);
|
|
1778
1780
|
setInscriberAddress(data.inscriberAddress);
|
|
1781
|
+
return data;
|
|
1779
1782
|
});
|
|
1780
1783
|
} catch (e) {
|
|
1781
1784
|
console.error(e);
|
|
@@ -1784,9 +1787,12 @@ var useInscriber = ({
|
|
|
1784
1787
|
setIsFetchingCommitPsbt(false);
|
|
1785
1788
|
}
|
|
1786
1789
|
}), [paymentAddress, paymentPublicKey, content, feeRate, mimeType, publicKey]);
|
|
1787
|
-
const handleSignCommit = () => __async(void 0, null, function* () {
|
|
1790
|
+
const handleSignCommit = (tx) => __async(void 0, null, function* () {
|
|
1788
1791
|
try {
|
|
1789
|
-
const
|
|
1792
|
+
const toBeSigned = tx != null ? tx : commitPsbtHex;
|
|
1793
|
+
if (!toBeSigned)
|
|
1794
|
+
throw new Error("missing tx");
|
|
1795
|
+
const signedResponse = yield signPsbt(toBeSigned, true, true);
|
|
1790
1796
|
setCommitTxId(signedResponse == null ? void 0 : signedResponse.txId);
|
|
1791
1797
|
return signedResponse == null ? void 0 : signedResponse.txId;
|
|
1792
1798
|
} catch (e) {
|
|
@@ -1796,6 +1802,7 @@ var useInscriber = ({
|
|
|
1796
1802
|
});
|
|
1797
1803
|
const inscribe = (0, import_react2.useCallback)(() => __async(void 0, null, function* () {
|
|
1798
1804
|
try {
|
|
1805
|
+
setIsInscribing(true);
|
|
1799
1806
|
if (!content)
|
|
1800
1807
|
throw new Error("missing content");
|
|
1801
1808
|
if (!address2)
|
|
@@ -1803,10 +1810,11 @@ var useInscriber = ({
|
|
|
1803
1810
|
if (!mimeType)
|
|
1804
1811
|
throw new Error("missing mimeType");
|
|
1805
1812
|
if (!commitTxId) {
|
|
1806
|
-
|
|
1807
|
-
yield
|
|
1813
|
+
console.log("commitTxId not found, getting commit psbt");
|
|
1814
|
+
const signed = yield getCommitPsbt();
|
|
1815
|
+
console.log({ signed });
|
|
1816
|
+
yield handleSignCommit(signed.psbtBase64);
|
|
1808
1817
|
}
|
|
1809
|
-
setIsInscribing(true);
|
|
1810
1818
|
yield delay(1e4);
|
|
1811
1819
|
return yield import_axios3.default.post(`${inscribeApiUrl}/inscribe`, {
|
|
1812
1820
|
content,
|
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;
|
|
@@ -1698,6 +1700,7 @@ var useInscriber = ({
|
|
|
1698
1700
|
setFeeRate(feeRate);
|
|
1699
1701
|
setTotalFees(data.totalFees);
|
|
1700
1702
|
setInscriberAddress(data.inscriberAddress);
|
|
1703
|
+
return data;
|
|
1701
1704
|
});
|
|
1702
1705
|
} catch (e) {
|
|
1703
1706
|
console.error(e);
|
|
@@ -1706,9 +1709,12 @@ var useInscriber = ({
|
|
|
1706
1709
|
setIsFetchingCommitPsbt(false);
|
|
1707
1710
|
}
|
|
1708
1711
|
}), [paymentAddress, paymentPublicKey, content, feeRate, mimeType, publicKey]);
|
|
1709
|
-
const handleSignCommit = () => __async(void 0, null, function* () {
|
|
1712
|
+
const handleSignCommit = (tx) => __async(void 0, null, function* () {
|
|
1710
1713
|
try {
|
|
1711
|
-
const
|
|
1714
|
+
const toBeSigned = tx != null ? tx : commitPsbtHex;
|
|
1715
|
+
if (!toBeSigned)
|
|
1716
|
+
throw new Error("missing tx");
|
|
1717
|
+
const signedResponse = yield signPsbt(toBeSigned, true, true);
|
|
1712
1718
|
setCommitTxId(signedResponse == null ? void 0 : signedResponse.txId);
|
|
1713
1719
|
return signedResponse == null ? void 0 : signedResponse.txId;
|
|
1714
1720
|
} catch (e) {
|
|
@@ -1718,6 +1724,7 @@ var useInscriber = ({
|
|
|
1718
1724
|
});
|
|
1719
1725
|
const inscribe = useCallback(() => __async(void 0, null, function* () {
|
|
1720
1726
|
try {
|
|
1727
|
+
setIsInscribing(true);
|
|
1721
1728
|
if (!content)
|
|
1722
1729
|
throw new Error("missing content");
|
|
1723
1730
|
if (!address2)
|
|
@@ -1725,10 +1732,11 @@ var useInscriber = ({
|
|
|
1725
1732
|
if (!mimeType)
|
|
1726
1733
|
throw new Error("missing mimeType");
|
|
1727
1734
|
if (!commitTxId) {
|
|
1728
|
-
|
|
1729
|
-
yield
|
|
1735
|
+
console.log("commitTxId not found, getting commit psbt");
|
|
1736
|
+
const signed = yield getCommitPsbt();
|
|
1737
|
+
console.log({ signed });
|
|
1738
|
+
yield handleSignCommit(signed.psbtBase64);
|
|
1730
1739
|
}
|
|
1731
|
-
setIsInscribing(true);
|
|
1732
1740
|
yield delay(1e4);
|
|
1733
1741
|
return yield axios3.post(`${inscribeApiUrl}/inscribe`, {
|
|
1734
1742
|
content,
|