mirror of
https://github.com/Retropex/umbrel-bitcoin.git
synced 2025-05-12 19:20:49 +02:00

Co-authored-by: Luke Childs <lukechilds123@gmail.com> Co-authored-by: Mayank Chhabra <mayankchhabra9@gmail.com> Co-authored-by: Steven Briscoe <me@stevenbriscoe.com>
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
const constants = require('utils/const.js');
|
|
const NodeError = require('models/errors.js').NodeError;
|
|
|
|
function getBitcoinP2PConnectionDetails() {
|
|
const torAddress = constants.BITCOIN_P2P_HIDDEN_SERVICE;
|
|
const port = constants.BITCOIN_P2P_PORT;
|
|
const torConnectionString = `${torAddress}:${port}`;
|
|
const localAddress = constants.DEVICE_DOMAIN_NAME;
|
|
const localConnectionString = `${localAddress}:${port}`;
|
|
|
|
return {
|
|
torAddress,
|
|
port,
|
|
torConnectionString,
|
|
localAddress,
|
|
localConnectionString
|
|
};
|
|
}
|
|
|
|
function getBitcoinRPCConnectionDetails() {
|
|
const hiddenService = constants.BITCOIN_RPC_HIDDEN_SERVICE;
|
|
const label = 'My Umbrel';
|
|
const rpcuser = constants.BITCOIN_RPC_USER;
|
|
const rpcpassword = constants.BITCOIN_RPC_PASSWORD;
|
|
const torAddress = hiddenService;
|
|
const port = constants.BITCOIN_RPC_PORT;
|
|
const torConnectionString = `btcrpc://${rpcuser}:${rpcpassword}@${torAddress}:${port}?label=${encodeURIComponent(label)}`;
|
|
const localAddress = constants.DEVICE_DOMAIN_NAME;
|
|
const localConnectionString = `btcrpc://${rpcuser}:${rpcpassword}@${localAddress}:${port}?label=${encodeURIComponent(label)}`;
|
|
|
|
return {
|
|
rpcuser,
|
|
rpcpassword,
|
|
torAddress,
|
|
port,
|
|
torConnectionString,
|
|
localAddress,
|
|
localConnectionString
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
getBitcoinP2PConnectionDetails,
|
|
getBitcoinRPCConnectionDetails,
|
|
};
|