This commit is contained in:
Josh Harvey 2017-03-06 14:22:33 +02:00
parent 0bf54fa1d8
commit 30071151ff
6 changed files with 107 additions and 242 deletions

View file

@ -6,10 +6,21 @@ const FETCH_INTERVAL = 5000
function fetchWallet (settings, cryptoCode) {
return Promise.resolve()
.then(() => {
console.log('DEBUG44')
console.log('DEBUG44.0.0: %j', cryptoCode)
try {
console.log('DEBUG44.0: %j', configManager.cryptoScoped(cryptoCode, settings.config).wallet)
} catch (err) {
console.log('DEBUG44.0.e: %s', err.stack)
}
const plugin = configManager.cryptoScoped(cryptoCode, settings.config).wallet
console.log('DEBUG44.1')
const account = settings.accounts[plugin]
console.log('DEBUG44.2')
const wallet = require('lamassu-' + plugin)
console.log('DEBUG45: %j', {wallet, account})
return {wallet, account}
})
}
@ -21,11 +32,15 @@ function balance (settings, cryptoCode) {
}
function sendCoins (settings, toAddress, cryptoAtoms, cryptoCode) {
console.log('DEBUG40')
return fetchWallet(settings, cryptoCode)
.then(r => {
console.log('DEBUG41')
return r.wallet.sendCoins(r.account, toAddress, cryptoAtoms, cryptoCode)
.then(res => {
console.log('DEBUG42')
mem.clear(module.exports.balance)
console.log('DEBUG43: %j', res)
return res
})
})