2023-03-04 04:25:07 +03:00
|
|
|
import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js";
|
|
|
|
import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js";
|
|
|
|
import type { Networkish } from "./network.js";
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The interface to an [[link-eip-1193]] provider, which is a standard
|
|
|
|
* used by most injected providers, which the [[BrowserProvider]] accepts
|
|
|
|
* and exposes the API of.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
export interface Eip1193Provider {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* See [[link-eip-1193]] for details on this method.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
request(request: {
|
|
|
|
method: string;
|
|
|
|
params?: Array<any> | Record<string, any>;
|
|
|
|
}): Promise<any>;
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The possible additional events dispatched when using the ``"debug"``
|
|
|
|
* event on a [[BrowserProvider]].
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
export type DebugEventBrowserProvider = {
|
|
|
|
action: "sendEip1193Payload";
|
|
|
|
payload: {
|
|
|
|
method: string;
|
|
|
|
params: Array<any>;
|
|
|
|
};
|
|
|
|
} | {
|
|
|
|
action: "receiveEip1193Result";
|
|
|
|
result: any;
|
|
|
|
} | {
|
|
|
|
action: "receiveEip1193Error";
|
|
|
|
error: Error;
|
|
|
|
};
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A **BrowserProvider** is intended to wrap an injected provider which
|
|
|
|
* adheres to the [[link-eip-1193]] standard, which most (if not all)
|
|
|
|
* currently do.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
export declare class BrowserProvider extends JsonRpcApiPollingProvider {
|
|
|
|
#private;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Connnect to the %%ethereum%% provider, optionally forcing the
|
|
|
|
* %%network%%.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
constructor(ethereum: Eip1193Provider, network?: Networkish);
|
|
|
|
send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
|
|
|
|
_send(payload: JsonRpcPayload | Array<JsonRpcPayload>): Promise<Array<JsonRpcResult | JsonRpcError>>;
|
|
|
|
getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolves to ``true`` if the provider manages the %%address%%.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
hasSigner(address: number | string): Promise<boolean>;
|
|
|
|
getSigner(address?: number | string): Promise<JsonRpcSigner>;
|
|
|
|
}
|
2023-04-27 15:19:55 +03:00
|
|
|
//# sourceMappingURL=provider-browser.d.ts.map
|