Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit fb070a9

Browse files
committed
Linted the code
1 parent 52f3930 commit fb070a9

4 files changed

Lines changed: 29 additions & 22 deletions

File tree

src/BitcoinHelpers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ const BitcoinHelpers = {
290290
throw new Error("Electrum client not configured.")
291291
}
292292

293-
const electrumClient = new ElectrumClient(BitcoinHelpers.electrumConfig, BitcoinHelpers.electrsConfig)
293+
const electrumClient = new ElectrumClient(
294+
BitcoinHelpers.electrumConfig,
295+
BitcoinHelpers.electrsConfig
296+
)
294297

295298
await electrumClient.connect()
296299

src/lib/ElectrumClient.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export default class Client {
6666
* @param {Config} config Electrum client connection configuration.
6767
* @param {string} apiUrl Url to the electrs server
6868
*/
69-
constructor(config, apiUrl) { // TODO: config will be removed once all ported
69+
constructor(config, apiUrl) {
70+
// TODO: config will be removed once all ported
7071
this.electrumClient = new ElectrumClient(
7172
config.server,
7273
config.port,

test/BitcoinSPVTest.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BitcoinSPV } from "../src/lib/BitcoinSPV.js"
22
import ElectrumClient from "../src/lib/ElectrumClient.js"
3-
import { electrumConfig } from "./config/network.js"
3+
import { electrsConfig, electrumConfig } from "./config/network.js"
44
import { readFileSync } from "fs"
55
import { assert } from "chai"
66

@@ -12,7 +12,10 @@ describe("BitcoinSPV", async () => {
1212
before(async () => {
1313
const txData = readFileSync("./test/data/tx.json", "utf8")
1414
tx = JSON.parse(txData)
15-
electrumClient = new ElectrumClient(electrumConfig["testnet"])
15+
electrumClient = new ElectrumClient(
16+
electrumConfig["testnet"],
17+
electrsConfig["testnet"]
18+
)
1619
bitcoinSPV = new BitcoinSPV(electrumClient)
1720
await electrumClient.connect()
1821
})

test/ElectrumClientTest.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,31 +193,31 @@ describe("ElectrumClient", async () => {
193193
console.log("result", result)
194194
})
195195

196-
// This test cannot be executed as part of CI. It takes too long to wait
197-
// for confirmations. Use this for manual testing.
198-
// TODO: Make it possible with electrum server mock.
199-
it.skip("wait for three more confirmations", async () => {
200-
const txHash = tx.hash
196+
// This test cannot be executed as part of CI. It takes too long to wait
197+
// for confirmations. Use this for manual testing.
198+
// TODO: Make it possible with electrum server mock.
199+
it.skip("wait for three more confirmations", async () => {
200+
const txHash = tx.hash
201201

202-
const currentTx = await client.getTransaction(txHash)
202+
const currentTx = await client.getTransaction(txHash)
203203

204-
const requiredConfirmations = currentTx.confirmations + 3
204+
const requiredConfirmations = currentTx.confirmations + 3
205205

206-
const callback = async function() {
207-
// Get current state of the transaction.
208-
const tx = await client.getTransaction(txHash)
206+
const callback = async function() {
207+
// Get current state of the transaction.
208+
const tx = await client.getTransaction(txHash)
209209

210-
// Check if transaction has already enough number of confirmations.
210+
// Check if transaction has already enough number of confirmations.
211211

212-
console.log("current confirmations:", tx.confirmations)
213-
if (tx.confirmations >= requiredConfirmations) {
214-
return tx.txid
215-
}
212+
console.log("current confirmations:", tx.confirmations)
213+
if (tx.confirmations >= requiredConfirmations) {
214+
return tx.txid
216215
}
216+
}
217217

218-
const result = await client.onNewBlock(callback)
218+
const result = await client.onNewBlock(callback)
219219

220-
console.log("result", result)
221-
})
220+
console.log("result", result)
221+
})
222222
})
223223
})

0 commit comments

Comments
 (0)