@particle-network/connectkit
Version:
51 lines (50 loc) • 2.61 kB
TypeScript
/// <reference types="node" />
import type { RefObject } from 'react';
import type { WalletProps } from '../hooks/useWalletsProps';
export declare const defaultTokenIcon = "https://static.particle.network/token-list/defaultToken/default.png";
interface ElementDimensions {
width: number;
height: number;
topDistance: number;
bottomDistance: number;
}
declare const truncateEthAddress: (address?: string, separator?: string) => string;
declare const detectBrowser: () => "" | import("detect-browser").Browser | "bot" | "node" | "react-native";
declare const detectOS: () => "" | import("detect-browser").OperatingSystem | NodeJS.Platform;
declare const isIOS: () => boolean;
declare const isAndroid: () => boolean;
declare const isMobile: () => boolean;
export declare const isWalletConnectConnector: (connectorId?: string) => boolean;
export { detectBrowser, detectOS, isAndroid, isIOS, isMobile, truncateEthAddress };
export declare const hexToRgba: (hex: any, alpha: any) => string;
export declare const shortAddress: (address: string | undefined | null) => string;
/**
* Copy text to clipboard
* @param {string} text
* @returns {Promise<void>}
*/
export declare function copyToClipboard(text: string): Promise<unknown>;
export declare const openMobileUrl: (url: string) => void;
export declare const hasPCDownloadUrl: (walletProps: WalletProps) => boolean;
/**
* 代币规则:
* 最多保留小数点后9位,只展示到最后一个非零数字位。当整数位超过5位,小数后位数逐渐减少。整数为超过15位时,使用科学计数法,小数点后两位
* @param bn
* @param decimal
* @param decimalPlaces
*/
export declare const formatTokenAmount: (value: bigint | number | `0x${string}`, decimal: number, decimalPlaces?: number) => string;
export declare function getElementDimensionsRelativeToParent(ref: RefObject<HTMLElement | null>): ElementDimensions | null;
export declare function getBuyUrl(chainId?: number, address?: string, currency?: string, theme?: string, language?: string): string;
export declare function popupWindow(url: string, title: string, w: number, h: number): Window | null;
export declare const roundToEven: (value: number) => number;
export declare function hexToRgbaColor(hex: any, alpha: any): string;
/**
* Judge whether the user is registering a passkey for the first time
* @returns {boolean} True if it's the first time, false otherwise
*/
export declare const isFirstRegisterPasskey: () => boolean;
/**
* Set that the user has completed passkey registration
*/
export declare const setFirstRegisterPasskey: () => void;