forked from BlueWallet/rn-electrum-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
23 lines (19 loc) · 1.01 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const net = require('net');
const tls = require('tls');
const assert = require('assert');
const ElectrumClient = require("./index");
(async () => {
let client = new ElectrumClient(net, false, 50001, 'electrum1.bluewallet.io', 'tcp');
let ver = await client.initElectrum({ client: 'bluewallet', version: '1.4' });
let balance = await client.blockchainScripthash_getBalance('716decbe1660861c3d93906cb1d98ee68b154fd4d23aed9783859c1271b52a9c');
assert.ok(balance)
assert.ok(ver[0].toLowerCase().includes('electrum'));
assert.strictEqual(balance.confirmed, 51432);
client = new ElectrumClient(net, tls, 443, 'electrum1.bluewallet.io', 'ssl');
ver = await client.initElectrum({ client: 'bluewallet', version: '1.4' });
balance = await client.blockchainScripthash_getBalance('716decbe1660861c3d93906cb1d98ee68b154fd4d23aed9783859c1271b52a9c');
assert.ok(balance)
assert.ok(ver[0].toLowerCase().includes('electrum'));
assert.strictEqual(balance.confirmed, 51432);
process.exit(0);
})();