getBuyWithCryptoStatus

Gets the status of a buy with crypto transaction

Example

import { getBuyWithCryptoStatus, getBuyWithCryptoQuote } @thirdweb-dev/sdk";
// get a quote between two tokens
const quote = await getBuyWithCryptoQuote(quoteParams);
// if approval is required, send the approval transaction
if (quote.approval) {
const response = await signer.sendTransaction(quote.approval);
}
// send the quoted transaction
const transactionResult = await signer.sendTransaction(
quote.transactionRequest,
);
// keep polling the status of the quoted transaction until it * returns a success or failure status
const status = await getBuyWithCryptoStatus({
clientId: "YOUR_CLIENT_ID",
transactionHash: transactionResult.hash,
});
function getBuyWithCryptoStatus(
buyWithCryptoTransaction: BuyWithCryptoTransaction,
): Promise<BuyWithCryptoStatus>;

Parameters

Object of type BuyWithCryptoTransaction

Type

let buyWithCryptoTransaction: {
client: ThirdwebClient;
transactionHash: string;
};

Returns

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