Files
api/packages/api-provider/src/http/state.js
T
Jaco Greeff 21c14bd85c Add pubsub interface definition (#54)
* Add pubsub interface definition

* Functional JsonRpcCoder

* Functional HttpProvider

* Functional WsProvider

* Functional split completed

* Split actual method subscription

* Update flow

* Flatten no user-specified array in sub call
2018-03-15 12:59:49 +01:00

22 lines
584 B
JavaScript

// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import type { HttpState } from './types';
const assert = require('@polkadot/util/assert');
const l = require('@polkadot/util/logger')('api-http');
const coder = require('../coder/json');
module.exports = function state (endpoint: string): HttpState {
assert(/^http:\/\//.test(endpoint), `Endpoint should start with 'http://', received '${endpoint}'`);
return {
coder: coder(),
endpoint,
l
};
};