Skip to content

Commit

Permalink
Updated signature for JsonRpcProvider.send to match EIP-1193.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Feb 10, 2020
1 parent 375bd15 commit b962b59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/providers/src.ts/ipc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/providers/src.ts/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 3 additions & 11 deletions packages/providers/src.ts/web3-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -65,7 +57,7 @@ export class Web3Provider extends JsonRpcProvider {
const request = {
method: method,
params: params,
id: 42,
id: (this._nextId++),
jsonrpc: "2.0"
};

Expand Down

0 comments on commit b962b59

Please sign in to comment.