UNPKG

@funkit/connect

Version:

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

55 lines (54 loc) 1.98 kB
import type { CheckoutQuoteResponse } from '@funkit/utils'; import type { Config } from 'wagmi'; import { LoginType } from '~/providers/GeneralWalletProvider'; import type { FunkitActiveCheckoutItem } from '../providers/FunkitCheckoutContext'; import { PaymentMethod, type PaymentMethodInfo } from './paymentMethods'; export interface BrokerageDetails { availableBalance: number; availableBalanceInFiat: number; isAboveMaximum: boolean; isBelowMinimum: boolean; maximumAmount: number | undefined | null; maximumAmountInFiat: number | undefined | null; minimumAmount: number; minimumAmountInFiat: 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; meshCostUsd: 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): Promise<{ fees: CheckoutFees; }>; export {};