UNPKG

@funkit/connect

Version:

Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.

24 lines (23 loc) 1.05 kB
import type { FunkitCheckoutQuoteResult } from '../../../domains/quote'; import { type CheckoutQuoteResult } from '../../../providers/FunkitQuoteContext'; export interface SourceAssetConfirmed { isQuoteSuccess: boolean; maxTargetAssetAmount: number | undefined; } /** * * Note: this hook is EXTREMELY confusing in what is doing * first, it useHackyTriggerWorkaroundReactDevBrainExplode to wait React's setState * and read the latest update of the checkoutItem * second, it will trigger a quote request to the backend * and write the value back to the checkoutItem * finally, it will also set the newPaymentMethodInfo to * the checkoutItem * * USE THIS WITH CAUTION **/ export declare function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult: (result: CheckoutQuoteResult) => void, setPreloadedQuoteData?: (quoteData: FunkitCheckoutQuoteResult) => void): { isSourceAssetConfirming: boolean; triggerAssetConfirm: () => void; onSourceAssetConfirmed: (preloadQuoteData?: boolean) => Promise<CheckoutQuoteResult>; };