Make lib rely on tls/net internally.

This commit is contained in:
softsimon 2020-12-29 14:13:55 +07:00
parent be9541b0cb
commit 0dedfdb1b5
3 changed files with 6 additions and 26 deletions

View File

@ -20,15 +20,4 @@ Electrum Protocol Client for node.js.
## usage
Relies on `react-native-tcp` so it should be already installed and linked in RN project. `net` should be provided from outside, this library wont do `require('net')`.
For RN it should be in `shim.js`:
```javascript
global.net = require('react-native-tcp');
```
For nodejs it should be provided before usage:
```javascript
global.net = require('net');
```
Relies on `net` so will only run in NodeJS environment.

View File

@ -1,16 +1,6 @@
'use strict';
/**
* expecting NET & TLS to be injected from outside:
* for RN it should be in shim.js:
* global.net = require('react-native-tcp');
* global.tls = require('react-native-tcp/tls');
*
* for nodejs tests it should be provided before tests:
* global.net = require('net');
* global.tls = require('tls');
* */
let net = global.net;
let tls = global.tls;
let net = require('net');
let tls = require('tls');
const TIMEOUT = 5000;
const TlsSocketWrapper = require('./TlsSocketWrapper.js');

View File

@ -1,6 +1,6 @@
{
"name": "@mempool/electrum-client",
"version": "1.1.7",
"version": "1.1.8",
"description": "Electrum protocol client for React Native & Node.js",
"main": "index.js",
"scripts": {
@ -27,7 +27,8 @@
{ "name": "Yuki Akiyama" },
{ "name": "7kharov" },
{ "name": "overtorment" },
{ "name": "janoside" }
{ "name": "janoside" },
{ "name": "softsimon" }
],
"license": "MIT"
}