getBuyWithCryptoStatus
Gets the status of a buy with crypto transaction
import { sendTransaction } from "thirdweb";import { getBuyWithCryptoStatus, getBuyWithCryptoQuote } from "thirdweb/pay"; // get a quote between two tokensconst quote = await getBuyWithCryptoQuote(quoteParams); // if approval is required, send the approval transactionif (quote.approval) { const txResult = await sendTransaction({ transaction: quote.approval, account: account, // account from connected wallet }); await waitForReceipt(txResult);} // send the quoted transactionconst swapTxResult = await sendTransaction({ transaction: quote.transactionRequest, account: account, // account from connected wallet }); await waitForReceipt(swapTxResult); // keep polling the status of the quoted transaction until it returns a success or failure statusconst status = await getBuyWithCryptoStatus({ client, transactionHash: swapTxResult.transactionHash,}});
function getBuyWithCryptoStatus(
Object of type BuyWithCryptoTransaction
let buyWithCryptoTransaction: { transactionHash: string;};
let returnType: | { status: "NOT_FOUND" } | { bridge?: string; failureMessage?: string; fromAddress: string; purchaseData?: object; quote: BuyWithCryptoQuoteSummary; status: BuyWithCryptoStatuses; subStatus: BuyWithCryptoSubStatuses; swapType: SwapType; toAddress: string; };
Object of type BuyWithCryptoStatus