-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates the UI
- Loading branch information
Showing
81 changed files
with
37,083 additions
and
123,925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
node_modules | ||
node_modules | ||
dist | ||
data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
|
||
], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": [ | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const constants = require("utils/const.js"); | ||
const NodeError = require("models/errors.js").NodeError; | ||
|
||
async function getElectrumConnectionDetails() { | ||
try { | ||
const port = constants.ELECTRUM_PORT; | ||
|
||
const torAddress = constants.ELECTRUM_HIDDEN_SERVICE; | ||
const torConnectionString = `${torAddress}:${port}:t`; | ||
|
||
const localAddress = constants.ELECTRUM_LOCAL_SERVICE; | ||
const localConnectionString = `${torAddress}:${port}:t`; | ||
|
||
return { | ||
tor: { | ||
address: torAddress, | ||
port, | ||
connectionString: torConnectionString, | ||
}, | ||
local: { | ||
address: localAddress, | ||
port, | ||
connectionString: localConnectionString, | ||
}, | ||
}; | ||
} catch (error) { | ||
console.log("error: ", error); | ||
throw new NodeError("Unable to get Electrum hidden service url"); | ||
} | ||
} | ||
|
||
module.exports = { | ||
getElectrumConnectionDetails, | ||
}; |
14 changes: 0 additions & 14 deletions
14
apps/backend/logs/.1f5960d808de963276f029d4d1a01f9b556f5224-audit.json
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
apps/backend/logs/.581cab841d3ca3d4d1f74fd45e20ada03a64bad6-audit.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable no-magic-numbers */ | ||
function NodeError(message, statusCode) { | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = this.constructor.name; | ||
this.message = message; | ||
this.statusCode = statusCode; | ||
} | ||
require('util').inherits(NodeError, Error); | ||
|
||
function BitcoindError(message, error, statusCode) { | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = this.constructor.name; | ||
this.message = message; | ||
this.error = error; | ||
this.statusCode = statusCode; | ||
} | ||
require('util').inherits(BitcoindError, Error); | ||
|
||
function ValidationError(message, statusCode) { | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = this.constructor.name; | ||
this.message = message; | ||
this.statusCode = statusCode || 400; | ||
} | ||
require('util').inherits(ValidationError, Error); | ||
|
||
module.exports = { | ||
NodeError, | ||
BitcoindError, | ||
ValidationError | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const express = require("express"); | ||
const router = express.Router(); | ||
const electrsService = require("services/electrs"); | ||
|
||
const systemLogic = require("logic/system.js"); | ||
const safeHandler = require("utils/safeHandler"); | ||
|
||
router.get( | ||
"/electrum-connection-details", | ||
safeHandler(async (req, res) => { | ||
const connectionDetails = await systemLogic.getElectrumConnectionDetails(); | ||
return res.status(200).json(connectionDetails); | ||
}) | ||
); | ||
|
||
router.get( | ||
"/version", | ||
safeHandler(async (req, res) => { | ||
try { | ||
const version = await electrsService.getVersion(); | ||
return res.status(200).json(version); | ||
} catch (e) { | ||
console.error("version error: ", e); | ||
return res.status(500).json(e); | ||
} | ||
}) | ||
); | ||
|
||
router.get( | ||
"/syncPercent", | ||
safeHandler(async (req, res) => { | ||
try { | ||
const syncPercent = await electrsService.syncPercent(); | ||
|
||
return res.status(200).json(syncPercent); | ||
} catch (e) { | ||
console.error("syncPercent error: ", e); | ||
return res.status(500).json(e); | ||
} | ||
}) | ||
); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const camelizeKeys = require("camelize-keys"); | ||
const RpcClient = require("bitcoind-rpc"); | ||
|
||
const BitcoindError = require("models/errors.js").BitcoindError; | ||
|
||
const BITCOIND_RPC_PORT = process.env.RPC_PORT || 18443; // eslint-disable-line no-magic-numbers, max-len | ||
const BITCOIND_HOST = process.env.BITCOIN_HOST || "172.28.0.2"; | ||
const BITCOIND_RPC_USER = process.env.RPC_USER || "umbrel"; | ||
const BITCOIND_RPC_PASSWORD = | ||
process.env.RPC_PASSWORD || "7-9j7pEXcV2s4cM_3JKfk-30eEmei94PRmUaDpHId-s="; | ||
|
||
const rpcClient = new RpcClient({ | ||
protocol: "http", | ||
user: BITCOIND_RPC_USER, // eslint-disable-line object-shorthand | ||
pass: BITCOIND_RPC_PASSWORD, // eslint-disable-line object-shorthand | ||
host: BITCOIND_HOST, | ||
port: BITCOIND_RPC_PORT | ||
}); | ||
|
||
function promiseify(rpcObj, rpcFn, what) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
rpcFn.call(rpcObj, (err, info) => { | ||
if (err) { | ||
reject(new BitcoindError(`Unable to obtain ${what}`, err)); | ||
} else { | ||
resolve(camelizeKeys(info, "_")); | ||
} | ||
}); | ||
} catch (error) { | ||
reject(error); | ||
} | ||
}); | ||
} | ||
|
||
function getBlockChainInfo() { | ||
return promiseify(rpcClient, rpcClient.getBlockchainInfo, "blockchain info"); | ||
} | ||
|
||
module.exports = { | ||
getBlockChainInfo | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const ElectrumClient = require("@lily-technologies/electrum-client"); | ||
const bitcoindService = require("services/bitcoind"); | ||
|
||
const ELECTRS_HOST = process.env.ELECTRS_HOST || "0.0.0.0"; | ||
const rpcClient = new ElectrumClient(50001, ELECTRS_HOST, "tcp"); | ||
|
||
async function getVersion() { | ||
const initClient = await rpcClient.initElectrum({ | ||
client: "umbrel", | ||
version: "1.4" | ||
}); | ||
|
||
// versionInfo[0] comes in as electrs/0.9.4, so we parse | ||
const version = initClient.versionInfo[0].substring( | ||
initClient.versionInfo[0].indexOf("/") + 1 | ||
); | ||
return version; | ||
} | ||
|
||
// This is a little hacky way of determining if electrs is sync'd to bitcoind | ||
// see https://github.com/romanz/electrs/pull/543#issuecomment-973078262 | ||
async function syncPercent() { | ||
// first, check if bitcoind isn't still IBD | ||
const { | ||
result: bitcoindResponse | ||
} = await bitcoindService.getBlockChainInfo(); | ||
if (bitcoindResponse.initialblockdownload) { | ||
return 0; | ||
} | ||
|
||
// if not IBD, then check bitcoind height to electrs height | ||
const initClient = await rpcClient.initElectrum({ | ||
client: "umbrel", | ||
version: "1.4" | ||
}); | ||
|
||
const { | ||
height: electrsHeight | ||
} = await initClient.blockchainHeaders_subscribe(); | ||
return (electrsHeight / bitcoindResponse.blocks) * 100; | ||
} | ||
|
||
module.exports = { | ||
getVersion, | ||
syncPercent | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
/* eslint-disable id-length */ | ||
module.exports = { | ||
REQUEST_CORRELATION_NAMESPACE_KEY: 'umbrel-manager-request', | ||
REQUEST_CORRELATION_ID_KEY: 'reqId', | ||
DEVICE_HOSTNAME: process.env.DEVICE_HOSTNAME || 'umbrel.local', | ||
BITCOIN_P2P_HIDDEN_SERVICE: process.env.BITCOIN_P2P_HIDDEN_SERVICE, | ||
BITCOIN_P2P_PORT: process.env.BITCOIN_P2P_PORT || 8333, | ||
BITCOIN_RPC_HIDDEN_SERVICE: process.env.BITCOIN_RPC_HIDDEN_SERVICE, | ||
BITCOIN_RPC_PORT: process.env.BITCOIN_RPC_PORT || 8332, | ||
BITCOIN_RPC_USER: process.env.BITCOIN_RPC_USER || 'umbrel', | ||
BITCOIN_RPC_PASSWORD: process.env.BITCOIN_RPC_PASSWORD || 'moneyprintergobrrr', | ||
REQUEST_CORRELATION_NAMESPACE_KEY: "umbrel-electrs-request", | ||
REQUEST_CORRELATION_ID_KEY: "reqId", | ||
|
||
ELECTRUM_HIDDEN_SERVICE: | ||
process.env.ELECTRUM_HIDDEN_SERVICE || "/var/lib/tor/electrum/hostname", | ||
|
||
ELECTRUM_LOCAL_SERVICE: process.env.ELECTRUM_LOCAL_SERVICE || "umbrel.local", | ||
|
||
ELECTRUM_PORT: process.env.ELECTRUM_PORT || 50001, | ||
}; |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.