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])
[options]
object
options.url
string
Full json rpc http url
[options.timeout]
number
30*1000
Request time out in ms
[options.retry]
number
1
Retry number
[options.keepAlive]
boolean
false
Whether open the http keep-alive option
[options.logger]
object
Logger with info
and error
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.
data
object
data.method
string
Json rpc method name.
[data.params]
array
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.
method
string
Json rpc method name.
...params
Array.<any>
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.
method
string
Json rpc method name.
[params]
array
Json rpc method params.
Example
baseProvider.batch(array) ⇒ Promise.<Array>
Promise.<Array>
Batch call json rpc methods with params
Kind: instance method of BaseProvider
array
Array.<object>
Array of object with "method" and "params"
Example
Last updated