Updated signature for JsonRpcProvider.send to match EIP-1193.

This commit is contained in:
Richard Moore 2020-02-10 15:39:38 -05:00
parent 375bd15594
commit b962b59ab7
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
3 changed files with 5 additions and 13 deletions

@ -29,7 +29,7 @@ export class IpcProvider extends JsonRpcProvider {
// @TODO: Create a connection to the IPC path and use filters instead of polling for block
send(method: string, params: any): Promise<any> {
send(method: string, params: Array<any>): Promise<any> {
// This method is very simple right now. We create a new socket
// connection each time, which may be slower, but the main
// advantage we are aiming for now is security. This simplifies

@ -290,7 +290,7 @@ export class JsonRpcProvider extends BaseProvider {
});
}
send(method: string, params: any): Promise<any> {
send(method: string, params: Array<any>): Promise<any> {
let request = {
method: method,
params: params,

@ -19,14 +19,6 @@ export type AsyncSendable = {
send?: (request: any, callback: (error: any, response: any) => void) => void
}
/*
@TODO
utils.defineProperty(Web3Signer, "onchange", {
});
*/
export class Web3Provider extends JsonRpcProvider {
readonly provider: AsyncSendable;
private _sendAsync: (request: any, callback: (error: any, response: any) => void) => void;
@ -45,14 +37,14 @@ export class Web3Provider extends JsonRpcProvider {
}
}
if (!web3Provider || !this._sendAsync) {
if (!this._sendAsync) {
logger.throwArgumentError("invalid web3Provider", "web3Provider", web3Provider);
}
defineReadOnly(this, "provider", web3Provider);
}
send(method: string, params: any): Promise<any> {
send(method: string, params: Array<any>): Promise<any> {
// Metamask complains about eth_sign (and on some versions hangs)
if (method == "eth_sign" && this.provider.isMetaMask) {
@ -65,7 +57,7 @@ export class Web3Provider extends JsonRpcProvider {
const request = {
method: method,
params: params,
id: 42,
id: (this._nextId++),
jsonrpc: "2.0"
};