@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
46 lines (45 loc) • 2.73 kB
TypeScript
import type { ApiFunkitCheckoutQuoteResult, CheckoutQuoteResponse } from '@funkit/utils';
import type { Address } from 'viem';
import type { Config } from 'wagmi';
import type { BluvoBrokerageQuote } from '~/hooks/useBluvo';
import type { FunkitDirectExecutionInfo } from '~/hooks/useCheckoutDirectExecution';
import type { FunkitActiveCheckoutItem } from '~/providers/FunkitCheckoutContext';
import type { LoginType } from '~/providers/GeneralWalletProvider';
import { type BrokerageDetails, type CheckoutFees } from './fees';
import { type PaymentMethodInfo } from './paymentMethods';
export interface FunkitCheckoutQuoteResult extends Omit<ApiFunkitCheckoutQuoteResult, 'finalFeesBreakdown'> {
finalSpreadUsd: string;
finalFeesBreakdown: CheckoutFees;
}
export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutItem, userId: string, walletAddress: Address, apiKey: string, wagmiConfig: Config, directExecutionInfo: FunkitDirectExecutionInfo, senderAddress?: Address, isWithdrawal?: boolean): Promise<CheckoutQuoteResponse>;
export declare function getQuoteFinalEstimation(baseQuote: CheckoutQuoteResponse, checkoutItem: FunkitActiveCheckoutItem, newPaymentMethodInfo: PaymentMethodInfo, wagmiConfig: Config, apiKey: string, loginType: LoginType, isWithdrawal?: boolean, brokerageQuote?: BluvoBrokerageQuote): Promise<{
finalEstimation: FunkitCheckoutQuoteResult;
brokerage?: BrokerageDetails;
}>;
export interface CheckedAssetAmount {
isAboveMaximum: boolean;
isBelowMinimum: boolean;
maxTargetAssetAmount?: number;
minTargetAssetAmount?: number;
}
export declare function checkAssetAmount(checkoutItem: FunkitActiveCheckoutItem, newPaymentMethodInfo: PaymentMethodInfo, finalEstimation: FunkitCheckoutQuoteResult, wagmiConfig: Config, walletAddress: Address, brokerage?: BrokerageDetails): Promise<CheckedAssetAmount>;
export interface CheckoutQuoteParams {
checkoutItem: FunkitActiveCheckoutItem;
userId: string;
walletAddress: Address;
apiKey: string;
newPaymentMethodInfo: PaymentMethodInfo;
wagmiConfig: Config;
loginType: LoginType;
directExecutionInfo: FunkitDirectExecutionInfo;
/** when sender address is different from wallet address
* this happens when withdrawing from a different wallet
**/
senderAddress?: Address;
isWithdrawal?: boolean;
}
export declare function getQuoteAndEstimation({ checkoutItem, userId, walletAddress, apiKey, newPaymentMethodInfo, wagmiConfig, loginType, directExecutionInfo, senderAddress, isWithdrawal, }: CheckoutQuoteParams): Promise<{
baseQuote: CheckoutQuoteResponse;
checkedAssetAmount: CheckedAssetAmount;
finalEstimation: FunkitCheckoutQuoteResult;
}>;