Browse Source
Added getConnectedPeer method to helpers/index.js.
get-transaction-merkle
Corey Phillips
3 years ago
No known key found for this signature in database
GPG Key ID: 80C0975F55D3A07B
1 changed files with
10 additions and
1 deletions
-
helpers/index.js
|
|
@ -298,6 +298,14 @@ const getPeers = ({ id = Math.random(), network = "" } = {}) => { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const getConnectedPeer = (network = 'bitcoin') => { |
|
|
|
try { |
|
|
|
return clients?.peer[network] ?? ''; |
|
|
|
} catch { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const subscribeHeader = async ({ id = "subscribeHeader", network = "", onReceive = () => null } = {}) => { |
|
|
|
try { |
|
|
|
if (clients.mainClient[network] === false) await connectToRandomPeer(network, clients.peers[network]); |
|
|
@ -446,5 +454,6 @@ module.exports = { |
|
|
|
subscribeHeader, |
|
|
|
subscribeAddress, |
|
|
|
getFeeEstimate, |
|
|
|
broadcastTransaction |
|
|
|
broadcastTransaction, |
|
|
|
getConnectedPeer |
|
|
|
}; |
|
|
|