* 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
22 lines
584 B
JavaScript
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
|
|
};
|
|
};
|