@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
54 lines (53 loc) • 1.95 kB
TypeScript
import type { CheckoutQuoteResponse } from '@funkit/utils';
import type { Config } from 'wagmi';
import type { BluvoBrokerageQuote } from '~/hooks/useBluvo';
import { LoginType } from '~/providers/GeneralWalletProvider';
import type { FunkitActiveCheckoutItem } from '../providers/FunkitCheckoutContext';
import { PaymentMethod, type PaymentMethodInfo } from './paymentMethods';
export interface BrokerageDetails {
isAboveMaximum: boolean;
isBelowMinimum: boolean;
maximumAmount: number | undefined | null;
minimumAmount: number;
}
interface BaseCheckoutFees {
paymentMethod: PaymentMethod;
marketMakerFeeUsd: number;
liquidityProviderFeeUsd: number;
totalFeesUsd: number;
/** does not include the gas fee since it can be in a
* different token than the source token */
totalFeesTokenWithoutGas: number;
}
interface WalletCheckoutFees extends BaseCheckoutFees {
paymentMethod: PaymentMethod.ACCOUNT_BALANCE;
eoaWalletFeeToken: number;
nativeCurrencySymbol: string;
eoaWalletFeeUsd: number;
}
interface CardCheckoutFees extends BaseCheckoutFees {
paymentMethod: PaymentMethod.CARD;
cardProcessingFeeUsd: number;
moonpayCostUsd: number;
}
interface BrokerageCheckoutFees extends BaseCheckoutFees {
paymentMethod: PaymentMethod.BROKERAGE;
exchangeFeeUsd: number;
}
export type CheckoutFees = WalletCheckoutFees | CardCheckoutFees | BrokerageCheckoutFees;
interface EvaluateFeeBreakdownItem {
baseQuote: CheckoutQuoteResponse;
selectedSourceAssetInfo: FunkitActiveCheckoutItem['selectedSourceAssetInfo'];
newPaymentMethodInfo: PaymentMethodInfo;
wagmiConfig: Config;
apiKey: string;
loginType: LoginType;
isWithdrawal?: boolean;
}
export declare function evaluateFeeBreakdown(evalItem: EvaluateFeeBreakdownItem & {
brokerageQuote?: BluvoBrokerageQuote;
}): Promise<{
fees: CheckoutFees;
brokerage?: BrokerageDetails;
}>;
export {};