Migrate plugins to lib directory
This commit is contained in:
parent
09b29bba56
commit
e7ab8223c2
27 changed files with 869 additions and 858 deletions
|
|
@ -1,11 +1,5 @@
|
|||
const configManager = require('./config-manager')
|
||||
|
||||
function noExchangeError (cryptoCode) {
|
||||
const err = new Error('No exchange plugin defined for: ' + cryptoCode)
|
||||
err.name = 'NoExchangeError'
|
||||
|
||||
return err
|
||||
}
|
||||
const ph = require('./plugin-helper')
|
||||
|
||||
function lookupExchange (settings, cryptoCode) {
|
||||
return configManager.cryptoScoped(cryptoCode, settings.config).exchange
|
||||
|
|
@ -15,9 +9,8 @@ function fetchExchange (settings, cryptoCode) {
|
|||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const plugin = lookupExchange(settings, cryptoCode)
|
||||
if (!plugin) throw noExchangeError(cryptoCode)
|
||||
const exchange = ph.load(ph.EXCHANGE, plugin)
|
||||
const account = settings.accounts[plugin]
|
||||
const exchange = require('lamassu-' + plugin)
|
||||
|
||||
return {exchange, account}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue