@particle-network/authkit
Version:
Auth Core provides MPC (Multi-Party Computation)-based threshold signatures.
104 lines (103 loc) • 3.28 kB
TypeScript
import type { AuthType, ERC4337Options, ServerError, UserInfo } from '@particle-network/auth-core';
import type { WalletCustomStyle, WalletOption } from '@particle-network/wallet';
import type { Chain as ViemChain } from 'viem/chains';
import type { PromptSettingConfig } from '../api/model/bundle';
import type { CurrencyUnit, Theme } from '../types';
export type ViewType = 'desktop' | 'mobile';
export interface NavigateOptions {
replace?: boolean;
back?: boolean;
state?: any;
}
export interface IAuthCoreModal {
rootModalContainer: HTMLDivElement | null;
rootBody: HTMLDivElement | null;
particleModalVisible: boolean;
viewType: ViewType;
closable?: boolean;
}
export interface ICustomRouter {
path: string;
replace?: boolean;
state?: any;
history?: any[];
children?: React.ReactNode;
}
export declare enum AuthCoreModalEvent {
Login = "login",// 登录
LoginSuccess = "loginSuccess",// 登录成功
LoginFail = "loginFail",// 登录失败
SignResponse = "signResponse"
}
export type Language = 'en' | 'zh-cn' | 'ja' | 'ko' | 'zh-tw';
export interface ThemeStyle {
primaryBtnColor?: string;
primaryBtnBackgroundColor?: string;
secondaryBtnColor?: string;
secondaryBtnBackgroundColor?: string;
textColor?: string;
secondaryTextColor?: string;
themeBackgroundColor?: string;
iconBorderColor?: string;
accentColor?: string;
inputBackgroundColor?: string;
inputBorderColor?: string;
inputPlaceholderColor?: string;
cardBorderColor?: string;
cardUnclickableBackgroundColor?: string;
cardUnclickableBorderColor?: string;
cardDividerColor?: string;
tagBackgroundColor?: string;
modalBackgroundColor?: string;
tipsBackgroundColor?: string;
}
export interface CustomStyle {
logo?: string;
projectName?: string;
subtitle?: string;
modalWidth?: number;
modalHeight?: number;
zIndex?: number;
primaryBtnBorderRadius?: number | string;
modalBorderRadius?: number | string;
cardBorderRadius?: number | string;
fontFamily?: string;
theme?: {
dark?: ThemeStyle;
light?: ThemeStyle;
};
}
export interface AuthCoreModalOptions {
projectId: string;
clientKey: string;
appId: string;
authTypes?: AuthType[];
themeType?: Theme;
fiatCoin?: CurrencyUnit;
erc4337?: ERC4337Options;
language?: Language;
promptSettingConfig?: PromptSettingConfig;
customStyle?: CustomStyle;
chains: readonly [ViemChain, ...ViemChain[]];
wallet?: (Omit<WalletOption, 'language' | 'erc4337' | 'customStyle'> & {
customStyle?: Omit<WalletCustomStyle, 'supportChains'>;
}) | false;
supportEIP6963?: boolean;
web3Modal?: any;
}
export type ConnectionStatus = 'loading' | 'connecting' | 'connected' | 'disconnected';
export type SocialConnectCallback = {
onSuccess?: (info: UserInfo) => void;
onError?: (error: ServerError | Error) => void;
};
export interface OpenBuyOptions {
network?: string;
fiatCoin?: string;
cryptoCoin?: string;
fiatAmt?: number;
fixFiatCoin?: boolean;
fixCryptoCoin?: boolean;
fixFiatAmt?: boolean;
walletAddress?: string;
}
export type OpenBuyOptionsKeys = keyof OpenBuyOptions;