@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
31 lines (30 loc) • 1.93 kB
TypeScript
import React from 'react';
import type { SourceChangeTopComponentProps } from '../../modals/CheckoutModal/stepTransition';
import { type PolymarketAccount } from './createPolymarketDepositConfig';
/** The account fields the picker needs: address + its live balance getter. */
export type PolymarketAccountDisplay = Pick<PolymarketAccount, 'address' | 'getBalanceUsd'>;
export interface PolymarketDepositAccountDropdownProps extends Partial<SourceChangeTopComponentProps> {
/** Predictions account (the user's predictions proxy). */
predictions: PolymarketAccountDisplay;
/** Perps account. */
perps: PolymarketAccountDisplay;
}
/**
* Polymarket "Deposit to" account picker, shown on top of the source-change
* screen via `uiCustomizations.sourceChangeScreen.customTopComponent`. Lets the
* user pick which account to deposit into (Predictions / Perps); the "Transfer
* between accounts" action navigates the checkout modal to the perps transfer
* step (`FunCheckoutStep.PERPS_TRANSFER`) via the modal's own step transition,
* so it animates and supports Back like any other step.
*
* Balances are live: predictions reads the pUSD balance of the predictions
* proxy; perps reads the perps account value, minting a perps proxy (one-time
* wallet signature) on first use. They load through {@link usePolymarketAccountBalances}
* — a shared cache keyed by address — so the balance the picker fetches is the
* same one the transfer step reads on navigation (no reload flash).
*
* The integrator supplies the predictions and perps accounts (address + live
* balance getter). Selecting one points the checkout at it; "Transfer between
* accounts" opens the perps transfer step.
*/
export declare function PolymarketDepositAccountDropdown({ onStepChange, modalState, dynamicRoutingId, applyDynamicTargetAssetCandidate, predictions, perps, }: PolymarketDepositAccountDropdownProps): React.JSX.Element;