1 | ;
|
2 |
|
3 | // Copyright 2017-2018 Jaco Greeff
|
4 | // This software may be modified and distributed under the terms
|
5 | // of the ISC license. See the LICENSE file for details.
|
6 | const assert = require('@polkadot/util/assert');
|
7 |
|
8 | const l = require('@polkadot/util/logger')('api-http');
|
9 |
|
10 | const coder = require('../coder/json');
|
11 |
|
12 | module.exports = function state(endpoint) {
|
13 | assert(/^(https|http):\/\//.test(endpoint), `Endpoint should start with 'http://', received '${endpoint}'`);
|
14 | return {
|
15 | coder: coder(),
|
16 | endpoint,
|
17 | l
|
18 | };
|
19 | }; |
\ | No newline at end of file |