fix: Fixes #208. Uses correct HTTP or WS URL prefix and port (#209)

This commit is contained in:
Luke Schoen
2018-10-05 23:00:20 +02:00
committed by Jaco Greeff
parent 50d7fdccfd
commit ae54a71dc9
3 changed files with 11 additions and 11 deletions
+5 -5
View File
@@ -17,7 +17,7 @@ const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSocke
/**
* @name HttpProvider
* @summary The HTTP Provider allows sending requests using HTTP.
* @summary The HTTP Provider allows sending requests using HTTP to a HTTP RPC server TCP port.
* @description It does not support subscriptions so you won't be able to listen to events
* such as new blocks or balance changes. It is usually preferrable using the [[WsProvider]].
*
@@ -25,11 +25,11 @@ const ERROR_SUBSCRIBE = 'HTTP Provider does not have subscriptions, use WebSocke
* <BR>
*
* ```javascript
* import createApi from '@polkadot/api';
* import WsProvider from '@polkadot/api-provider/ws';
* import Api from '@polkadot/api';
* import HttpProvider from '@polkadot/api-provider/http';
*
* const provider = new WsProvider('http://127.0.0.1:9933');
* const api = createApi(provider);
* const provider = new HttpProvider('http://127.0.0.1:9933');
* const api = new Api(provider);
* ```
*
* @see [[WsProvider]]
+4 -4
View File
@@ -39,18 +39,18 @@ interface WSProviderInterface extends ProviderInterface {
/**
* @name WsProvider
* @summary The WebSocket Provider allows sending requests using WebSocket.
* @summary The WebSocket Provider allows sending requests using WebSocket to a WebSocket RPC server TCP port.
* @description Unlike the [[HttpProvider]], it does support subscriptions and allows
* listening to events such as new blocks or balance changes.
* @example
* <BR>
*
* ```javascript
* import createApi from '@polkadot/api';
* import Api from '@polkadot/api';
* import WsProvider from '@polkadot/api-provider/ws';
*
* const provider = new WsProvider('ws://127.0.0.1:9944');
* const api = createApi(provider);
* const api = new Api(provider);
* ```
*
* @see [[HttpProvider]]
@@ -182,7 +182,7 @@ export default class WsProvider extends E3.EventEmitter implements WSProviderInt
*
* ```javascript
* const provider = new WsProvider('ws://127.0.0.1:9944');
* const api = createApi(provider);
* const api = new Api(provider);
*
* api.state.storage([[storage.balances.freeBalance, <Address>]], (_, values) => {
* console.log(values)
+2 -2
View File
@@ -24,7 +24,7 @@ import isFunction from '@polkadot/util/is/function';
* import Api from '@polkadot/api';
* import WsProvider from '@polkadot/api-provider/ws';
*
* const provider = new WsProvider('http://127.0.0.1:9944');
* const provider = new WsProvider('ws://127.0.0.1:9944');
* const api = new Api(provider);
* ```
*/
@@ -61,7 +61,7 @@ export default class Api implements ApiInterface {
* <BR>
*
* ```javascript
* import Api from '@polkadot/Api';
* import Api from '@polkadot/api';
*
* Api.signature({ name: 'test_method', params: [ { name: 'dest', type: 'Address' } ], type: 'Address' }); // => test_method (dest: Address): Address
* ```