From 1a427e554e951379c1c0f82968a159d42f838047 Mon Sep 17 00:00:00 2001 From: hathbanger Date: Mon, 2 Dec 2024 15:53:23 -0700 Subject: [PATCH] fix waitfortransaction --- .../components/WalletCard.tsx | 2 +- packages/lasereyes-core/src/lib/helpers.ts | 13 ++++++++--- packages/lasereyes-core/src/lib/inscribe.ts | 22 +++++++++---------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/apps/demo.lasereyes.build/components/WalletCard.tsx b/apps/demo.lasereyes.build/components/WalletCard.tsx index 512c834a..30492b85 100644 --- a/apps/demo.lasereyes.build/components/WalletCard.tsx +++ b/apps/demo.lasereyes.build/components/WalletCard.tsx @@ -126,7 +126,7 @@ const WalletCard = ({ const isConnected = provider === walletName const isMissingWallet = !hasWallet[walletName] - const isSparrow = provider === SPARROW && isConnected + const isSparrow = wallet.name === SPARROW const { utxos } = useUtxos() diff --git a/packages/lasereyes-core/src/lib/helpers.ts b/packages/lasereyes-core/src/lib/helpers.ts index b2df64d6..c14bd4da 100644 --- a/packages/lasereyes-core/src/lib/helpers.ts +++ b/packages/lasereyes-core/src/lib/helpers.ts @@ -207,9 +207,16 @@ export async function broadcastTx( txHex: string, network: NetworkType ): Promise { - return await axios - .post(`${getMempoolSpaceUrl(network)}/api/tx`, txHex) - .then((res) => res.data) + const response = await axios.post( + `${getMempoolSpaceUrl(network)}/api/tx`, + txHex, + { + headers: { + 'Content-Type': 'text/plain', + }, + } + ); + return response.data; } export const getAddressType = ( diff --git a/packages/lasereyes-core/src/lib/inscribe.ts b/packages/lasereyes-core/src/lib/inscribe.ts index 933d1fc1..3d6e7db6 100644 --- a/packages/lasereyes-core/src/lib/inscribe.ts +++ b/packages/lasereyes-core/src/lib/inscribe.ts @@ -55,10 +55,10 @@ export const inscribeContent = async ({ network?: NetworkType ) => Promise< | { - signedPsbtHex: string | undefined - signedPsbtBase64: string | undefined - txId?: string - } + signedPsbtHex: string | undefined + signedPsbtBase64: string | undefined + txId?: string + } | undefined > network: NetworkType @@ -72,9 +72,9 @@ export const inscribeContent = async ({ const ixs = inscriptions ? inscriptions : Array(quantity).fill({ - content: contentBase64, - mimeType, - }) + content: contentBase64, + mimeType, + }) const commitTx = await getCommitTx({ inscriptions: ixs, @@ -130,9 +130,9 @@ export const getCommitTx = async ({ isDry?: boolean }): Promise< | { - psbtHex: string - psbtBase64: string - } + psbtHex: string + psbtBase64: string + } | undefined > => { try { @@ -422,7 +422,7 @@ export async function waitForTransaction( const startTime: number = Date.now() while (true) { try { - const rawTx: any = await getRawTransaction(txId, network) + const rawTx: any = await getTransaction(txId, network) if (rawTx) { console.log('Transaction found in mempool:', txId) return true