import type { ThirdwebClient } from "../../client/client.js"; import type { PurchaseData } from "../types.js"; import type { PayOnChainTransactionDetails, PayTokenInfo } from "../utils/commonTypes.js"; /** * @buyCrypto */ type BuyWithCryptoQuoteSummary = { fromToken: PayTokenInfo; toToken: PayTokenInfo; fromAmountWei: string; fromAmount: string; toAmountWei: string; toAmount: string; toAmountMin: string; toAmountMinWei: string; estimated: { fromAmountUSDCents: number; toAmountMinUSDCents: number; toAmountUSDCents: number; slippageBPS: number; feesUSDCents: number; gasCostUSDCents?: number; durationSeconds?: number; }; createdAt: string; }; /** * @buyCrypto */ export type BuyWithCryptoTransaction = { client: ThirdwebClient; transactionHash: string; chainId: number; }; type BuyWithCryptoStatuses = "NONE" | "PENDING" | "FAILED" | "COMPLETED"; type BuyWithCryptoSubStatuses = "NONE" | "WAITING_BRIDGE" | "REVERTED_ON_CHAIN" | "SUCCESS" | "PARTIAL_SUCCESS" | "UNKNOWN_ERROR" | "REFUNDED"; type SwapType = "SAME_CHAIN" | "CROSS_CHAIN" | "TRANSFER"; /** * The object returned by the [`getBuyWithCryptoStatus`](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoStatus) function to represent the status of a quoted transaction * @buyCrypto */ export type BuyWithCryptoStatus = { status: "NOT_FOUND"; } | { quote: BuyWithCryptoQuoteSummary; swapType: SwapType; source?: PayOnChainTransactionDetails; destination?: PayOnChainTransactionDetails; status: BuyWithCryptoStatuses; subStatus: BuyWithCryptoSubStatuses; fromAddress: string; toAddress: string; failureMessage?: string; bridge?: string; purchaseData?: PurchaseData; }; /** * Gets the status of a buy with crypto transaction * @param buyWithCryptoTransaction - Object of type [`BuyWithCryptoTransaction`](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransaction) * @example * * ```ts * import { sendTransaction } 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 txResult = await sendTransaction({ * transaction: quote.approval, * account: account, // account from connected wallet * }); * * await waitForReceipt(txResult); * } * * // send the quoted transaction * const 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 status * const status = await getBuyWithCryptoStatus({ * client, * transactionHash: swapTxResult.transactionHash, * }}); * ``` * @returns Object of type [`BuyWithCryptoStatus`](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoStatus) * @deprecated use Bridge.status instead * @buyCrypto */ export declare function getBuyWithCryptoStatus(buyWithCryptoTransaction: BuyWithCryptoTransaction): Promise; export {}; //# sourceMappingURL=getStatus.d.ts.map