fix example
This commit is contained in:
parent
0af5bab669
commit
17586c9723
@ -1,4 +1,5 @@
|
||||
const ElectrumClient = require('..')
|
||||
const ElectrumClient = require("..")
|
||||
|
||||
|
||||
const peers = require('electrum-host-parse').getDefaultPeers("BitcoinSegwit").filter(v => v.ssl)
|
||||
const getRandomPeer = () => peers[peers.length * Math.random() | 0]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const Client = require("../lib/electrum_cli")
|
||||
const Client = require("..")
|
||||
|
||||
const proc = async(cl) => {
|
||||
try{
|
||||
|
||||
@ -4,12 +4,16 @@ const main = async () => {
|
||||
const ecl = new ElectrumClient(995, 'btc.smsys.me', 'tls')
|
||||
await ecl.connect()
|
||||
try{
|
||||
const ver = await ecl.server_version("2.7.11", "1.0")
|
||||
const ver = await ecl.server_version("0", "0.9")
|
||||
console.log(ver)
|
||||
const balance = await ecl.blockchainAddress_getBalance("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX")
|
||||
console.log(balance)
|
||||
const unspent = await ecl.blockchainAddress_listunspent("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX")
|
||||
console.log(unspent)
|
||||
const tx1 = await ecl.blockchainTransaction_get("f91d0a8a78462bc59398f2c5d7a84fcff491c26ba54c4833478b202796c8aafd", false)
|
||||
console.log(tx1)
|
||||
const tx2 = await ecl.blockchainTransaction_get("f91d0a8a78462bc59398f2c5d7a84fcff491c26ba54c4833478b202796c8aafd", true)
|
||||
console.log(tx2)
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
22
example/simple_v12.js
Normal file
22
example/simple_v12.js
Normal file
@ -0,0 +1,22 @@
|
||||
const ElectrumClient = require('..')
|
||||
|
||||
const main = async () => {
|
||||
const ecl = new ElectrumClient(995, 'btc.smsys.me', 'tls')
|
||||
await ecl.connect()
|
||||
try{
|
||||
const ver = await ecl.server_version("0", "1.2")
|
||||
console.log(ver)
|
||||
const balance = await ecl.blockchainAddress_getBalance("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX")
|
||||
console.log(balance)
|
||||
const unspent = await ecl.blockchainAddress_listunspent("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX")
|
||||
console.log(unspent)
|
||||
const tx1 = await ecl.blockchainTransaction_get("f91d0a8a78462bc59398f2c5d7a84fcff491c26ba54c4833478b202796c8aafd", false)
|
||||
console.log(tx1)
|
||||
const tx2 = await ecl.blockchainTransaction_get("f91d0a8a78462bc59398f2c5d7a84fcff491c26ba54c4833478b202796c8aafd", true)
|
||||
console.log(JSON.stringify(tx2, null, 2))
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
await ecl.close()
|
||||
}
|
||||
main().catch(console.log)
|
||||
Loading…
Reference in New Issue
Block a user