(data, cb)
| 5 | const LIVENESS_CHECK=`{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":42}`; |
| 6 | |
| 7 | const parseAndRespond = (data, cb) => { |
| 8 | let resp; |
| 9 | try { |
| 10 | resp = JSON.parse(data); |
| 11 | if (resp.error) { |
| 12 | return cb(resp.error); |
| 13 | } |
| 14 | } catch (e) { |
| 15 | return cb('Version data is not valid JSON'); |
| 16 | } |
| 17 | if (!resp || !resp.result) { |
| 18 | return cb('No version returned'); |
| 19 | } |
| 20 | const [_, version, __] = resp.result.split('/'); |
| 21 | cb(null, version); |
| 22 | }; |
| 23 | |
| 24 | const testRpcWithEndpoint = (endpoint, cb) => { |
| 25 | const options = { |
no test coverage detected