import { JsonRpcRequest, JsonRpcSuccess, ErrorResponse, JsonRpcFailure, JsonRpcValidation, JsonRpcPayload, JsonRpcResponse, IRpcConfig, EncryptionPayload, IEvents, Any, ILog, ClientMetadata } from '@binance/w3w-types'; import EventEmitter from 'eventemitter3'; declare function payloadId(): number; declare function uuid(): string; declare function formatJsonRpcRequest(method: string, params: T, id?: number): JsonRpcRequest; declare function formatJsonRpcResult(id: number, result: T): JsonRpcSuccess; declare function formatJsonRpcError(id: number, error?: string | ErrorResponse, data?: string): JsonRpcFailure; declare function formatErrorMessage(error?: string | ErrorResponse, data?: string): ErrorResponse; declare function isServerErrorCode(code: number): boolean; declare function isReservedErrorCode(code: number): boolean; declare function isValidErrorCode(code: number): boolean; declare function getError(type: string): ErrorResponse; declare function getErrorByCode(code: number): ErrorResponse; declare function validateJsonRpcError(response: JsonRpcFailure): JsonRpcValidation; declare function parseConnectionError(e: Error, url: string, type: string): Error; declare const PARSE_ERROR = "PARSE_ERROR"; declare const INVALID_REQUEST = "INVALID_REQUEST"; declare const METHOD_NOT_FOUND = "METHOD_NOT_FOUND"; declare const INVALID_PARAMS = "INVALID_PARAMS"; declare const INTERNAL_ERROR = "INTERNAL_ERROR"; declare const SERVER_ERROR = "SERVER_ERROR"; declare const RESERVED_ERROR_CODES: number[]; declare const SERVER_ERROR_CODE_RANGE: number[]; declare const STANDARD_ERROR_MAP: { PARSE_ERROR: { code: number; message: string; }; INVALID_REQUEST: { code: number; message: string; }; METHOD_NOT_FOUND: { code: number; message: string; }; INVALID_PARAMS: { code: number; message: string; }; INTERNAL_ERROR: { code: number; message: string; }; SERVER_ERROR: { code: number; message: string; }; }; declare const DEFAULT_ERROR = "SERVER_ERROR"; declare function isJsonRpcPayload(payload: any): payload is JsonRpcPayload; declare function isJsonRpcResponse(payload: JsonRpcPayload): payload is JsonRpcResponse; declare function isJsonRpcSuccess(payload: JsonRpcPayload): payload is JsonRpcSuccess; declare function isJsonRpcError(payload: JsonRpcPayload): payload is JsonRpcFailure; declare function isHttpUrl(url: string): boolean; declare function isWsUrl(url: string): boolean; declare function isLocalhostUrl(url: string): boolean; declare const getDeepLink: (url: string, chainId?: number) => { http: string; bnc: string; }; declare function getInfuraRpcUrl(chainId: number, infuraId?: string): string | undefined; declare function safeJsonParse(value: string): T | string; declare function safeJsonStringify(value: any): string; declare function getRpcUrl(chainId: number, rpc: IRpcConfig): string | undefined; declare function isNode(): boolean; declare function normalizeChainId(chainId: string | number | bigint): number; declare const infuraNetworks: { 1: string; 3: string; 4: string; 5: string; 42: string; }; declare const signingMethods: string[]; declare function convertHexToArrayBuffer(hex: string): ArrayBuffer; declare function convertArrayBufferToHex(arrBuf: ArrayBuffer, noPrefix?: boolean): string; declare function convertBufferToArrayBuffer(buf: Buffer): ArrayBuffer; declare function convertArrayBufferToBuffer(arrBuf: ArrayBuffer): Buffer; declare function convertNumberToHex(num: number | string): string; declare function removeHexPrefix(hex: string): string; declare function hexToArray(hex: string): Uint8Array; declare function arrayToHex(arr: Uint8Array, prefixed?: boolean): string; declare function bufferToArray(buf: Buffer): Uint8Array; declare function bufferToHex(buf: Buffer, prefixed?: boolean): string; declare function typedArrayToBuffer(arr: Uint8Array): Buffer; declare function arrayToBuffer(arr: Uint8Array): Buffer; declare function addHexPrefix(hex: string): string; declare function concatArrays(...args: Uint8Array[]): Uint8Array; declare function utf8ToArray(utf8: string): Uint8Array; declare function utf8ToBuffer(utf8: string): Buffer; declare function bufferToUtf8(buf: Buffer): string; declare function arrayToUtf8(arr: Uint8Array): string; declare function utf8ToHex(utf8: string, prefixed?: boolean): string; declare function generateKey(length?: number): ArrayBuffer; declare function encrypt(data: JsonRpcRequest, key: ArrayBuffer, providedIv?: ArrayBuffer): EncryptionPayload; declare function decrypt(payload: EncryptionPayload, key: ArrayBuffer): JsonRpcRequest | JsonRpcSuccess | JsonRpcFailure | null; declare function getStorage(key: string): T | null; declare function removeStorage(key: string): void; declare function setStorage(key: string, data: T): void; declare class Events implements IEvents { events: EventEmitter; on: (name: string, listener: (...args: Any[]) => void) => EventEmitter; once: (name: string, listener: (...args: Any[]) => void) => EventEmitter; off: (name: string, listener: (...args: Any[]) => void) => EventEmitter; removeListener: (name: string, listener?: (...args: Any[]) => void) => EventEmitter; removeAllListeners: () => EventEmitter; } declare const log: ILog; declare function getClientMetadata(): ClientMetadata | null; declare class ProviderRpcError extends Error { code: number; constructor(code: number, message: string); toString(): string; } declare const CONNECTION_ERR: { CLOSE_MODAL: { code: number; message: string; }; REJECT_SESSION: { code: number; message: string; }; PROVIDER_NOT_READY: { code: number; message: string; }; CONNECTING: { code: number; message: string; }; CONNECTED: { code: number; message: string; }; }; declare const RPC_ERROR: { REJECT_ERR: { code: number; message: string; }; METHOD_NOT_SUPPORT: { code: number; message: string; }; MISSING_RESPONSE: { code: number; message: string; }; INVALID_PARAM: { code: number; message: string; }; }; declare const MISC_ERR: { INTERNAL_ERR: { code: number; message: string; }; }; declare const getIsMobile: () => boolean; declare const getIsAndroid: () => boolean; declare const getHref: (isAndroid: boolean, wc?: string) => string; declare const openBinanceDeepLink: (wc?: string) => void; declare const isInBinance: () => boolean; declare const isExtensionInstalled: () => boolean; declare global { interface Window { ethereum: any; binancew3w: any; } } declare const bnTransport: ({ custom, http }: { custom: any; http: any; }) => any; export { CONNECTION_ERR, DEFAULT_ERROR, Events, INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, METHOD_NOT_FOUND, MISC_ERR, PARSE_ERROR, ProviderRpcError, RESERVED_ERROR_CODES, RPC_ERROR, SERVER_ERROR, SERVER_ERROR_CODE_RANGE, STANDARD_ERROR_MAP, addHexPrefix, arrayToBuffer, arrayToHex, arrayToUtf8, bnTransport, bufferToArray, bufferToHex, bufferToUtf8, concatArrays, convertArrayBufferToBuffer, convertArrayBufferToHex, convertBufferToArrayBuffer, convertHexToArrayBuffer, convertNumberToHex, decrypt, encrypt, formatErrorMessage, formatJsonRpcError, formatJsonRpcRequest, formatJsonRpcResult, generateKey, getClientMetadata, getDeepLink, getError, getErrorByCode, getHref, getInfuraRpcUrl, getIsAndroid, getIsMobile, getRpcUrl, getStorage, hexToArray, infuraNetworks, isExtensionInstalled, isHttpUrl, isInBinance, isJsonRpcError, isJsonRpcPayload, isJsonRpcResponse, isJsonRpcSuccess, isLocalhostUrl, isNode, isReservedErrorCode, isServerErrorCode, isValidErrorCode, isWsUrl, log, normalizeChainId, openBinanceDeepLink, parseConnectionError, payloadId, removeHexPrefix, removeStorage, safeJsonParse, safeJsonStringify, setStorage, signingMethods, typedArrayToBuffer, utf8ToArray, utf8ToBuffer, utf8ToHex, uuid, validateJsonRpcError };