Docs

getBuyWithCryptoStatus

Gets the status of a buy with crypto transaction

Example

import { sendTransaction, prepareTransaction } from "thirdweb";
import { getBuyWithCryptoStatus, getBuyWithCryptoQuote } from "thirdweb/pay";
// get a quote between two tokens
const quote = await getBuyWithCryptoQuote(quoteParams);
// if approval is required, send the approval transaction
if (quote.approval) {
const preparedApproval = prepareTransaction(quote.approval);
await sendTransaction({
transaction,
wallet,
});
}
// send the quoted transaction
const preparedTransaction = prepareTransaction(quote.transactionRequest);
const transactionResult = await sendTransaction({
transaction,
wallet,
});
// keep polling the status of the quoted transaction until it returns a success or failure status
const status = await getBuyWithCryptoStatus({
client,
transactionHash: transactionResult.transactionHash,
}});

Parameters

Returns

Object of type BuyWithCryptoStatus