New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@electrum-cash/network

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@electrum-cash/network - npm Package Compare versions

Comparing version

to
4.0.0-development.6393041663

11

package.json
{
"name": "@electrum-cash/network",
"version": "4.0.0-development.6392223875",
"version": "4.0.0-development.6393041663",
"description": "@electrum-cash/network is a lightweight JavaScript library that lets you connect with one or more Electrum servers.",

@@ -22,3 +22,3 @@ "homepage": "https://gitlab.com/electrum-cash/network#readme",

"license": "MIT",
"source": "lib/index.ts",
"source": "source/index.ts",
"type": "module",

@@ -38,6 +38,6 @@ "module": "dist/index.mjs",

"analyze": "parcel build --reporter @parcel/reporter-bundle-analyzer",
"docs": "jsdoc -c jsdoc.json",
"docs": "typedoc --hideGenerator --categorizeByGroup",
"lint": "eslint . --ext .ts",
"syntax": "tsc --noEmit",
"spellcheck": "cspell 'lib/**' 'test/**' 'examples/**'",
"spellcheck": "cspell 'source/**' 'test/**' 'examples/**'",
"test": "vitest --dir test/ --test-timeout=15000 --run --coverage"

@@ -61,4 +61,5 @@ },

"events": "^3.3.0",
"jsdoc": "^4.0.2",
"parcel": "^2.9.2",
"typedoc": "^0.25.12",
"typedoc-plugin-coverage": "^3.1.0",
"typescript": "^5.1.3",

@@ -65,0 +66,0 @@ "vitest": "^1.3.1"

@@ -1,4 +0,5 @@

# electrum-cash
# Introduction
Electrum-cash is a lightweight `JavaScript` library that lets you connect with one or more `Electrum` servers.
@electrum-cash/network is a lightweight `JavaScript` library that lets you connect `Electrum` servers.
It offers encrypted connections by default,

@@ -13,3 +14,3 @@ performs the expected protocol version negotiation and

```bash
# npm install electrum-cash
# npm install @electrum-cash/network
```

@@ -25,3 +26,3 @@

// Load the electrum library.
const { ElectrumClient } = require('electrum-cash');
const { ElectrumClient } = require('@electrum-cash/network');
```

@@ -35,16 +36,15 @@

// Load the electrum library.
import { ElectrumClient, ElectrumTransport } from 'electrum-cash';
import { ElectrumClient, ElectrumTransport } from '@electrum-cash/network';
```
### Connect to servers
### Connecting to a server
After you have loaded the appropriate module you need to initialize the module by configuring your **application identifier** and **protocol version**.
After you have imported the library you need to initialize and connect the client by configuring your **application identifier** and **protocol version**.
If you only want to use a single server, initialize an `ElectrumClient` and connect to the server:
```js
// Initialize an electrum client.
const electrum = new ElectrumClient('Electrum client example', '1.4.1', 'bch.imaginary.cash');
const electrumClient = new ElectrumClient('Electrum client example', '1.4.1', 'bch.imaginary.cash');
// Wait for the client to connect
await electrum.connect();
await electrumClient.connect();
```

@@ -55,3 +55,3 @@

```js
const electrum = new ElectrumClient(
const electrumClient = new ElectrumClient(
'Electrum client example', '1.4.1', 'bch.imaginary.cash',

@@ -73,3 +73,3 @@ ElectrumTransport.WSS.Port, ElectrumTransport.WSS.Scheme

// Request the full transaction hex for the transaction ID.
const transactionHex = await electrum.request('blockchain.transaction.get', transactionID);
const transactionHex = await electrumClient.request('blockchain.transaction.get', transactionID);

@@ -109,6 +109,6 @@ // Print out the transaction hex.

// Listen for notifications.
electrum.on('notification', handleNotifications);
electrumClient.on('notification', handleNotifications);
// Set up a subscription for new block headers.
await electrum.subscribe('blockchain.headers.subscribe');
await electrumClient.subscribe('blockchain.headers.subscribe');
```

@@ -118,9 +118,7 @@

When you're done and don't want to be connected anymore you can disconnect the server(s).
When you're done and don't want to be connected anymore you can disconnect the server:
If you're using a single `ElectrumClient`, call the `disconnect()` function:
```js
// Close the connection.
await electrum.disconnect();
await electrumClient.disconnect();
```

@@ -130,3 +128,3 @@

For a complete list of methods and parameters, read the [API documentation](https://generalprotocols.gitlab.io/electrum-cash/library/).
For a complete list of methods and parameters, read the [API documentation](https://electrum-cash.gitlab.io/network/).

@@ -137,6 +135,4 @@ ## Support and communication

You can also read our tutorials on [read.cash](https://read.cash/c/electrum-cash-f45e), or share your own.
## Notes
The keep-alive functionality of this library only works when the protocol version is 1.2 or higher.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet