@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
26 lines (25 loc) • 1.23 kB
TypeScript
import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
import { type CheckoutQuoteResult } from '~/providers/FunkitQuoteContext';
import { type PaymentMethodInfo } from '../../domains/paymentMethods';
export interface SourceAssetConfirmed {
isQuoteSuccess: boolean;
maxTargetAssetAmount: number | undefined;
}
export declare function preparePaymentMethodInfo(selectedPaymentMethodInfo: PaymentMethodInfo | null): PaymentMethodInfo;
/**
*
* 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>;
};