Skip to content

Commit

Permalink
fix waitfortransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
hathbanger committed Dec 2, 2024
1 parent a4dcb26 commit 1a427e5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion apps/demo.lasereyes.build/components/WalletCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
13 changes: 10 additions & 3 deletions packages/lasereyes-core/src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,16 @@ export async function broadcastTx(
txHex: string,
network: NetworkType
): Promise<string> {
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 = (
Expand Down
22 changes: 11 additions & 11 deletions packages/lasereyes-core/src/lib/inscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -130,9 +130,9 @@ export const getCommitTx = async ({
isDry?: boolean
}): Promise<
| {
psbtHex: string
psbtBase64: string
}
psbtHex: string
psbtBase64: string
}
| undefined
> => {
try {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1a427e5

Please sign in to comment.