@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
55 lines (54 loc) • 2.79 kB
TypeScript
import type { FunkitCheckoutActionParams, FunkitCheckoutConfig, PolymarketTransferAccount } from '../../providers/FunkitCheckoutContext/types';
import { type PolymarketPerpsDepositConfig } from './polymarket';
/**
* Routing ids that select the deposit destination. The deposit dropdown writes
* the chosen id to `config.dynamicRoutingId`; the combined
* {@link createPolymarketDepositConfig} reads it to build the right deposit
* (predictions vs perps) within a single checkout.
*/
export declare const POLYMARKET_PREDICTIONS_ROUTING_ID = "POLYMARKET_PREDICTIONS";
export declare const POLYMARKET_PERPS_ROUTING_ID = "POLYMARKET_PERPS";
/**
* Builds the `generateActionsParams` for a Polymarket *Predictions* deposit:
* wrap USDC.e → pUSD into the predictions proxy via the CollateralOnramp,
* mediated by the VaultDepositor so it composes with EXACT_INPUT quoting (the
* VaultDepositor pulls msg.sender's full balance and substitutes
* AMOUNT_PLACEHOLDER at exec time).
*/
export declare function createPredictionsGenerateActionParams(config: PolymarketPerpsDepositConfig): () => Promise<FunkitCheckoutActionParams[]>;
/**
* A Polymarket account in the deposit picker / transfer step — the same
* integrator-owned shape the transfer step consumes (address, min-topup,
* transfer, live balance getter; see {@link PolymarketTransferAccount}).
* Both accounts share it, so each transfer direction is symmetrical.
*/
export type PolymarketAccount = PolymarketTransferAccount;
export interface CreatePolymarketDepositConfigParams {
/** Predictions account (the user's predictions proxy). */
predictions: PolymarketAccount;
/** Perps account. */
perps: PolymarketAccount;
/** Optional subtitle under the modal title, e.g. a balance line. */
modalTitleMeta?: string;
/**
* Optional per-destination modal title overrides. When omitted, the title
* follows the selected destination: "Deposit (Predictions)" /
* "Deposit (Perps)".
*/
modalTitles?: {
predictions?: string;
perps?: string;
};
/**
* Account preselected in the "Deposit to" dropdown when the modal opens.
* The user can still switch via the dropdown. Defaults to `'predictions'`.
*/
defaultAccount?: 'predictions' | 'perps';
}
/**
* Builds the entire Polymarket deposit checkout config from the two accounts.
* The "Deposit to" dropdown switches `dynamicRoutingId`; modal title, min
* deposit, recipient and on-chain deposit actions are derived per account.
* Integrators call this and render {@link PolymarketDepositAccountDropdown}.
*/
export declare function createPolymarketDepositConfig({ predictions, perps, modalTitleMeta, modalTitles, defaultAccount, }: CreatePolymarketDepositConfigParams): FunkitCheckoutConfig;