@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
31 lines (30 loc) • 1.63 kB
TypeScript
import type { Operation } from '@funkit/core';
import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
import { type CheckoutQuoteResult } from '~/providers/FunkitQuoteContext';
import { type PaymentMethodInfo } from '../../domains/paymentMethods';
import { LoginType } from '../../providers/GeneralWalletProvider';
export interface SourceAssetConfirmed {
isQuoteSuccess: boolean;
maxTargetAssetAmount: number | undefined;
}
export declare function preparePaymentMethodInfo(selectedPaymentMethodInfo: PaymentMethodInfo | null): PaymentMethodInfo;
export declare function fetchSponsorInitialTransferGasLimit(selectedPaymentMethodInfo: PaymentMethodInfo | null, loginType: LoginType, generateCheckoutTransferOpItems: (toAddress: string, tokenAmount: number | string) => Promise<{
transferOp: Operation | null;
}>): Promise<number>;
/**
*
* 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>;
};