///
import { JsonRpcRequest, JsonRpcResponse, ParticleRpcRequest, RequestArguments } from '@particle-network/auth';
import { EventEmitter } from 'events';
export declare class ProviderError extends Error {
code: number;
message: string;
data?: unknown;
constructor(code: number, message: string, data?: unknown);
static userRejectedRequest(): ProviderError;
static userCancelOperation(): ProviderError;
static unauthorized(): ProviderError;
static unsupportedMethod(): ProviderError;
static unsupportedChain(): ProviderError;
static disconnected(): ProviderError;
static chainDisconnected(): ProviderError;
static paramsError(): ProviderError;
}
export interface ProviderMessage {
type: string;
data: unknown;
}
export interface ProviderConnectInfo {
chainId: string;
}
export declare type ProviderChainId = string;
export declare type ProviderAccounts = string[];
export interface EIP1102Request extends RequestArguments {
method: 'eth_requestAccounts';
}
export interface ConnectionConfig {
url: string;
basicCredentials: string;
chainId: () => number;
authentication: ParticleAuthentication;
}
export interface ParticleAuthentication {
projectId: string;
clientKey: string;
}
export declare abstract class IEvents {
abstract events: EventEmitter;
abstract on(event: string, listener: any): this;
abstract once(event: string, listener: any): this;
abstract off(event: string, listener: any): this;
abstract removeListener(event: string, listener: any): this;
}
export declare abstract class IJsonRpcConnection extends IEvents {
events: EventEmitter;
abstract connected: boolean;
abstract connecting: boolean;
on(event: string, listener: any): this;
once(event: string, listener: any): this;
off(event: string, listener: any): this;
removeListener(event: string, listener: any): this;
abstract open(): Promise;
abstract close(): Promise;
abstract send(request: ParticleRpcRequest): Promise;
}
export declare abstract class IJsonRpcProvider extends IEvents implements IEthereumProvider {
events: EventEmitter;
on(event: string, listener: any): this;
once(event: string, listener: any): this;
off(event: string, listener: any): this;
removeListener(event: string, listener: any): this;
abstract request(request: Partial): Promise;
}
export interface IEthereumProvider {
on(event: 'connect', listener: (info: ProviderConnectInfo) => void): this;
on(event: 'disconnect', listener: (error?: ProviderError) => void): this;
on(event: 'message', listener: (message: ProviderMessage) => void): this;
on(event: 'chainChanged', listener: (chainId: ProviderChainId) => void): this;
on(event: 'accountsChanged', listener: (accounts: ProviderAccounts) => void): this;
on(event: string, listener: any): this;
once(event: string, listener: any): this;
off(event: string, listener: any): this;
removeListener(event: string, listener: any): this;
request(request: Partial): Promise;
}
export interface IAuthAdapter {
request(request: Partial): Promise;
}
export declare const notSupportMethods: string[];
export declare const signerMethods: string[];
export declare const particleSignerMethods: string[];