@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
53 lines (52 loc) • 2.72 kB
TypeScript
import React from 'react';
export type PerpsTransferDirection = 'toPerps' | 'toPredictions';
export type PerpsTransferStatus = 'idle' | 'processing' | 'success' | 'error';
export interface PolymarketPerpsTransferScreenProps {
/** Whether the modal is open. Defaults to true (the screen owns its Dialog). */
open?: boolean;
/** Modal title. Defaults to the localized "Transfer". */
title?: string;
/** Predictions account balance in USD. */
predictionsBalanceUsd: number;
/** Perps account balance in USD. */
perpsBalanceUsd: number;
/** Minimum pUSD to transfer *into* predictions (USD). Drives the
* below-minimum notice when the destination is Predictions. */
predictionsMinTransferUsd?: number;
/** Minimum pUSD to transfer *into* perps (USD). Drives the below-minimum
* notice when the destination is Perps (e.g. perps' 5 pUSD minimum). */
perpsMinTransferUsd?: number;
/** Initial transfer direction. Defaults to Predictions → Perps. */
initialDirection?: PerpsTransferDirection;
/** Initial amount input string (pUSD). */
initialAmountUsd?: string;
/**
* Visual status, controlled by the host so the same screen renders the
* idle / processing / success / error frames. `error` shows a retry-able
* Transfer button with an error notice. No transfer logic is wired here — the
* Transfer button simply reports clicks via {@link onTransfer}.
*/
status?: PerpsTransferStatus;
/**
* Fired when the (enabled) Transfer button is pressed, with the entered
* amount and direction — mirrors {@link usePerpsTransferForm}'s callback
* so a host receives everything it needs to perform the transfer.
*/
onTransfer: (params: {
amountUsd: string;
direction: PerpsTransferDirection;
}) => void;
onClose?: () => void;
onBack?: () => void;
}
/**
* Polymarket "Transfer" screen — moves a balance between the Predictions and
* Perps accounts. Self-contained: it renders its own Dialog so it can be used
* standalone or in a Storybook story. The in-checkout-modal variant is the
* `PerpsTransferStep` (which renders the same UI via {@link usePerpsTransferForm}
* as a registered step instead of a Dialog).
*
* UI only: balances are props, and the Transfer button's processing/success
* states are driven by the {@link status} prop rather than any real transfer.
*/
export declare function PolymarketPerpsTransferScreen({ open, title, predictionsBalanceUsd, perpsBalanceUsd, predictionsMinTransferUsd, perpsMinTransferUsd, initialDirection, initialAmountUsd, status, onTransfer, onClose, onBack, }: PolymarketPerpsTransferScreenProps): React.JSX.Element;