Skip to content

Commit

Permalink
fix(README): update example
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejonas committed Jul 14, 2020
1 parent a35f55d commit 9d7e0b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A browser-compatible JSON-RPC client with multiple transports:
import { RequestManager, HTTPTransport, Client } from "@open-rpc/client-js";
const transport = new HTTPTransport("http://localhost:8545");
const client = new Client(new RequestManager([transport]));
const result = await client.request("addition", [2, 2]);
const result = await client.request({method: "addition", params: [2, 2]});
// => { jsonrpc: '2.0', id: 1, result: 4 }
```

Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ class Client implements Provider {
/**
* A JSON-RPC call is represented by sending a Request object to a Server.
*
* @param method A String containing the name of the method to be invoked. Method names that begin with the word rpc
* @param requestObject.method A String containing the name of the method to be invoked. Method names that begin with the word rpc
* followed by a period character (U+002E or ASCII 46) are reserved for rpc-internal methods and extensions and
* MUST NOT be used for anything else.
* @param params A Structured value that holds the parameter values to be used during the invocation of the method.
* @param requestObject.params A Structured value that holds the parameter values to be used during the invocation of the method.
*/
public async request(args: ProviderRequestArguments, timeout?: number) {
public async request(requestObject: ProviderRequestArguments, timeout?: number) {
await this.requestManager.connectPromise;
return this.requestManager.request(args, false, timeout);
return this.requestManager.request(requestObject, false, timeout);
}

public async notify(args: ProviderRequestArguments) {
public async notify(requestObject: ProviderRequestArguments) {
await this.requestManager.connectPromise;
return this.requestManager.request(args, true);
return this.requestManager.request(requestObject, true);
}

public onNotification(callback: (data: any) => void) {
Expand Down

0 comments on commit 9d7e0b5

Please sign in to comment.