feat: add mock wallet scoring
This commit is contained in:
parent
b0fa62a9f3
commit
584492cb55
6 changed files with 76 additions and 6 deletions
27
lib/wallet-scoring.js
Normal file
27
lib/wallet-scoring.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
const ph = require('./plugin-helper')
|
||||
const _ = require('lodash/fp')
|
||||
const argv = require('minimist')(process.argv.slice(2))
|
||||
|
||||
function loadWalletScoring (settings) {
|
||||
if (_.isNil(argv.mockScoring)) {
|
||||
throw new Error('No wallet scoring API set!')
|
||||
}
|
||||
const pluginCode = argv.mockScoring ? 'mock-scoring' : ''
|
||||
const plugin = ph.load(ph.WALLET_SCORING, pluginCode)
|
||||
const account = settings.accounts[pluginCode]
|
||||
|
||||
return { plugin, account }
|
||||
}
|
||||
|
||||
function rateWallet (settings, address) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const { plugin, account } = loadWalletScoring(settings)
|
||||
|
||||
return plugin.rateWallet(account, address)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
rateWallet
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue