Provider
BaseProvider
Kind: global class
.requestId() ⇒
string
.request(data) ⇒
Promise.<*>
.call(method, ...params) ⇒
Promise.<*>
.send(method, [params]) ⇒
Promise.<*>
.batch(array) ⇒
Promise.<Array>
new BaseProvider([options])
Param | Type | Default | Description |
---|---|---|---|
[options] |
| ||
options.url |
| Full json rpc http url | |
[options.timeout] |
|
| Request time out in ms |
[options.retry] |
|
| Retry number |
[options.keepAlive] |
|
| Whether open the http keep-alive option |
[options.logger] |
| Logger with |
baseProvider.requestId() ⇒ string
string
Gen a random json rpc id. It is used in call
method, overwrite it to gen your own id.
Kind: instance method of BaseProvider
baseProvider.request(data) ⇒ Promise.<*>
Promise.<*>
Call a json rpc method with params
Kind: instance method of BaseProvider
Returns: Promise.<*>
- Json rpc method return value.
Param | Type | Description |
---|---|---|
data |
| |
data.method |
| Json rpc method name. |
[data.params] |
| Json rpc method params. |
Example
baseProvider.call(method, ...params) ⇒ Promise.<*>
Promise.<*>
Call a json rpc method with params
Kind: instance method of BaseProvider
Returns: Promise.<*>
- Json rpc method return value.
Param | Type | Description |
---|---|---|
method |
| Json rpc method name. |
...params |
| Json rpc method params. |
Example
baseProvider.send(method, [params]) ⇒ Promise.<*>
Promise.<*>
Send a json rpc method request
Kind: instance method of BaseProvider
Returns: Promise.<*>
- Json rpc method return value.
Param | Type | Description |
---|---|---|
method |
| Json rpc method name. |
[params] |
| Json rpc method params. |
Example
baseProvider.batch(array) ⇒ Promise.<Array>
Promise.<Array>
Batch call json rpc methods with params
Kind: instance method of BaseProvider
Param | Type | Description |
---|---|---|
array |
| Array of object with "method" and "params" |
Example
Last updated