WIP
This commit is contained in:
parent
c9b7a80e89
commit
a24f8d6a5a
2 changed files with 14 additions and 9 deletions
|
|
@ -91,4 +91,5 @@ module.exports = function (options) {
|
||||||
|
|
||||||
return server
|
return server
|
||||||
})
|
})
|
||||||
|
.catch(e => console.log(e.stack))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,6 @@ let lastAlertTime = null
|
||||||
exports.init = function init (connectionString, seedPath) {
|
exports.init = function init (connectionString, seedPath) {
|
||||||
const masterSeed = new Buffer(fs.readFileSync(seedPath, 'utf8').trim(), 'hex')
|
const masterSeed = new Buffer(fs.readFileSync(seedPath, 'utf8').trim(), 'hex')
|
||||||
hkdf = new HKDF('sha256', 'lamassu-server-salt', masterSeed)
|
hkdf = new HKDF('sha256', 'lamassu-server-salt', masterSeed)
|
||||||
|
|
||||||
db.init(connectionString)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPlugin (name, config) {
|
function loadPlugin (name, config) {
|
||||||
|
|
@ -130,9 +128,14 @@ function loadPlugin (name, config) {
|
||||||
return plugin
|
return plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, cfg, accounts, options,
|
function pp (o) {
|
||||||
|
console.log(require('util').inspect(o, {depth: null}))
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, config, accounts, options,
|
||||||
onChangeCallback) {
|
onChangeCallback) {
|
||||||
const currentName = cfg.cryptoServices[pluginType]
|
pp(config)
|
||||||
|
const currentName = config.cryptoServices[pluginType]
|
||||||
|
|
||||||
currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {}
|
currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {}
|
||||||
|
|
||||||
|
|
@ -175,15 +178,15 @@ exports.configure = function configure (config) {
|
||||||
const accounts = configManager.loadAccounts()
|
const accounts = configManager.loadAccounts()
|
||||||
|
|
||||||
console.log('DEBUG42')
|
console.log('DEBUG42')
|
||||||
deviceCurrency = config.fiat.fiatCurrency
|
|
||||||
// cryptoCodes = config.crypto.cryptoCurrencies TODO: add to admin
|
|
||||||
console.log('DEBUG43')
|
|
||||||
const cryptoCodes = getCryptoCodes()
|
const cryptoCodes = getCryptoCodes()
|
||||||
|
|
||||||
console.log('DEBUG30')
|
console.log('DEBUG30')
|
||||||
|
|
||||||
cryptoCodes.forEach(cryptoCode => {
|
cryptoCodes.forEach(cryptoCode => {
|
||||||
const cryptoScopedConfig = config.cryptoScoped(cryptoCode, cachedConfig)
|
console.log('DEBUG31')
|
||||||
|
const cryptoScopedConfig = configManager.cryptoScoped(cryptoCode, cachedConfig)
|
||||||
|
|
||||||
|
console.log('DEBUG31.1')
|
||||||
|
|
||||||
// TICKER [required] configure (or load)
|
// TICKER [required] configure (or load)
|
||||||
loadOrConfigPlugin(
|
loadOrConfigPlugin(
|
||||||
|
|
@ -199,7 +202,7 @@ exports.configure = function configure (config) {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log('DEBUG31')
|
console.log('DEBUG31.2')
|
||||||
|
|
||||||
// Give each crypto a different derived seed so as not to allow any
|
// Give each crypto a different derived seed so as not to allow any
|
||||||
// plugin to spend another plugin's funds
|
// plugin to spend another plugin's funds
|
||||||
|
|
@ -213,6 +216,7 @@ exports.configure = function configure (config) {
|
||||||
accounts,
|
accounts,
|
||||||
{masterSeed: cryptoSeed},
|
{masterSeed: cryptoSeed},
|
||||||
function onWalletChange (newWallet) {
|
function onWalletChange (newWallet) {
|
||||||
|
console.log('DEBUG34: %s, %j', cryptoCode, newWallet)
|
||||||
walletPlugins[cryptoCode] = newWallet
|
walletPlugins[cryptoCode] = newWallet
|
||||||
pollBalance(cryptoCode)
|
pollBalance(cryptoCode)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue