import { CONFIRMATION_STRATEGY_TYPE, LoginMethodConfig, ProviderConfig } from "@toruslabs/base-controllers"; import type { AccountAbstractionMultiChainConfig } from "@toruslabs/ethereum-controllers"; import { AUTH_CONNECTION_TYPE, AuthConnectionConfigItem, JRPCRequest, WEB3AUTH_NETWORK_TYPE, WhiteLabelData } from "@web3auth/auth"; import { LogLevelDesc } from "loglevel"; export { CONFIRMATION_STRATEGY, type CONFIRMATION_STRATEGY_TYPE } from "@toruslabs/base-controllers"; export declare const WS_EMBED_BUILD_ENV: { readonly PRODUCTION: "production"; readonly STAGING: "staging"; readonly DEVELOPMENT: "development"; readonly TESTING: "testing"; }; export declare const WS_EMBED_LOGIN_MODE: { readonly EMBED: "embed"; readonly PLUGIN: "plugin"; }; export type WS_EMBED_LOGIN_MODE_TYPE = (typeof WS_EMBED_LOGIN_MODE)[keyof typeof WS_EMBED_LOGIN_MODE]; export type WS_EMBED_BUILD_ENV_TYPE = (typeof WS_EMBED_BUILD_ENV)[keyof typeof WS_EMBED_BUILD_ENV]; export declare const BUTTON_POSITION: { readonly BOTTOM_LEFT: "bottom-left"; readonly TOP_LEFT: "top-left"; readonly BOTTOM_RIGHT: "bottom-right"; readonly TOP_RIGHT: "top-right"; }; export type BUTTON_POSITION_TYPE = (typeof BUTTON_POSITION)[keyof typeof BUTTON_POSITION]; export interface CtorArgs { /** * Z-index of the modal and iframe * @defaultValue 99999 */ modalZIndex?: number; /** * You can get your clientId/projectId by registering your * dapp on {@link "https://dashboard.web3auth.io"| developer dashboard} */ web3AuthClientId: string; /** * network specifies the web3auth network to be used. */ web3AuthNetwork: WEB3AUTH_NETWORK_TYPE; } export interface PaymentParams { /** * Address to send the funds to */ selectedAddress?: string; /** * Default fiat currency for the user to make the payment in */ selectedCurrency?: string; /** * Amount to buy in the selectedCurrency */ fiatValue?: number; /** * Cryptocurrency to buy */ selectedCryptoCurrency?: string; } export interface LoginParams { authConnection?: AUTH_CONNECTION_TYPE; authConnectionId?: string; groupedAuthConnectionId?: string; login_hint?: string; } export interface ConnectWithSessionParams { sessionId: string; idToken: string; sessionNamespace?: string; } export interface UserInfo { /** * Email of the logged in user */ email: string; /** * Full name of the logged in user */ name: string; /** * Profile image of the logged in user */ profileImage: string; /** * authConnection of the logged in user (google, facebook etc) */ authConnection: AUTH_CONNECTION_TYPE; /** * Auth Connection Id of the logged in user * * email for google, * id for facebook, * username for reddit, * id for twitch, * id for discord */ authConnectionId: string; /** * User Id of the logged in user */ userId: string; /** * Grouped Auth Connection Id of the logged in user */ groupedAuthConnectionId: string; } export interface WalletUrlConfig { url?: string; logLevel?: LogLevelDesc; } export type WsEmbedWhiteLabel = { /** * whether to show/hide ws-embed widget. * * Defaults to true * @defaultValue true */ showWidgetButton?: boolean; /** * Determines where the wsEmbed widget is visible on the page. * @defaultValue bottom-left */ buttonPosition?: BUTTON_POSITION_TYPE; hideNftDisplay?: boolean; hideTokenDisplay?: boolean; hideDefiPositionsDisplay?: boolean; hideTransfers?: boolean; hideTopup?: boolean; hideReceive?: boolean; hideSwap?: boolean; hideShowAllTokens?: boolean; hideWalletConnect?: boolean; defaultPortfolio?: "token" | "nft" | "defi"; } & WhiteLabelData; export interface WsEmbedParams { /** * Supported chains */ chains: ProviderConfig[]; /** * Chain to connect with */ chainId: string; /** * Auth Connection Config */ loginMethodConfig?: LoginMethodConfig; /** * Login Mode of WsEmbed. * * @defaultValue embed * @internal */ loginMode: WS_EMBED_LOGIN_MODE_TYPE; /** * Legacy Mode of WsEmbed. Used to enable legacy config for ws embed. * * @defaultValue false * @internal */ enableLegacyConfig?: boolean; /** * Build Environment of WsEmbed. * * production uses https://wallet.web3auth.io, * * staging uses https://staging-wallet.web3auth.io, * * testing uses https://develop-wallet.web3auth.io (latest internal build) * * development uses http://localhost:4050 (expects wallet-services-frontend to be run locally), * * @defaultValue production */ buildEnv?: WS_EMBED_BUILD_ENV_TYPE; /** * Enables or disables logging. * * Defaults to false in prod and true in other environments */ enableLogging?: boolean; /** * url of widget to load * * Defaults to true * @defaultValue true */ walletUrls?: Partial>; /** * Determines how to show confirmation screens * @defaultValue default * * default & popup * - use popop as default * - if wallet connect request use modal * * modal * - use modal always * * auto-approve * - does not work on embed. will use default */ confirmationStrategy?: CONFIRMATION_STRATEGY_TYPE; /** * Enable and configure account abstraction */ accountAbstractionConfig?: AccountAbstractionMultiChainConfig; /** * Enable private key export * * Defaults to false * @defaultValue false */ enableKeyExport?: boolean; /** * Allows you to customize the look & feel of the widget */ whiteLabel?: WsEmbedWhiteLabel; } export interface ProviderOptions { /** * The name of the stream used to connect to the wallet. */ jsonRpcStreamName?: string; /** * The maximum number of event listeners. */ maxEventListeners?: number; } export interface BaseProviderState { isConnected: boolean; initialized: boolean; isPermanentlyDisconnected: boolean; hasEmittedConnection: boolean; } export interface InPageProviderState extends BaseProviderState { accounts: null | string[]; isUnlocked: boolean; } export interface CommunicationProviderState extends BaseProviderState { buttonPosition: string; isLoggedIn: boolean; widgetVisibility: boolean; currentAuthConnection: AUTH_CONNECTION_TYPE; isIFrameFullScreen: boolean; allowWalletService: boolean; } export type Maybe = Partial | T | null | undefined; export interface UnValidatedJsonRpcRequest extends JRPCRequest { windowId?: string; } export interface WalletUiConfig { enablePortfolioWidget?: boolean; enableConfirmationModal?: boolean; enableWalletConnect?: boolean; enableTokenDisplay?: boolean; enableNftDisplay?: boolean; enableShowAllTokensButton?: boolean; enableBuyButton?: boolean; enableSendButton?: boolean; enableSwapButton?: boolean; enableReceiveButton?: boolean; enableDefiPositionsDisplay?: boolean; portfolioWidgetPosition?: BUTTON_POSITION_TYPE; defaultPortfolio?: "token" | "nft" | "defi"; } export interface ProjectConfig { teamId: number; userDataIncludedInToken?: boolean; sessionTime?: number; enableKeyExport?: boolean; walletConnectProjectId?: string; walletUi?: WalletUiConfig; embeddedWalletAuth?: (AuthConnectionConfigItem & { isDefault?: boolean; })[]; whitelabel?: WhiteLabelData; }