feat: add get txs hashes fallback on ciphertrace

This commit is contained in:
José Oliveira 2022-07-27 13:45:36 +01:00
parent bc1925a14c
commit 0a0b6eed2c
3 changed files with 35 additions and 13 deletions

View file

@ -1,13 +1,14 @@
const ph = require('./plugin-helper')
const _ = require('lodash/fp')
const argv = require('minimist')(process.argv.slice(2))
const configManager = require('./new-config-manager')
function loadWalletScoring (settings) {
function loadWalletScoring (settings, cryptoCode) {
const pluginCode = argv.mockScoring ? 'mock-scoring' : 'ciphertrace'
const wallet = cryptoCode ? ph.load(ph.WALLET, configManager.getWalletSettings(cryptoCode, settings.config).wallet) : null
const plugin = ph.load(ph.WALLET_SCORING, pluginCode)
const account = settings.accounts[pluginCode]
return { plugin, account }
return { plugin, account, wallet }
}
function rateWallet (settings, cryptoCode, address) {
@ -31,9 +32,9 @@ function isValidWalletScore (settings, score) {
function getTransactionHash (settings, cryptoCode, receivingAddress) {
return Promise.resolve()
.then(() => {
const { plugin, account } = loadWalletScoring(settings)
const { plugin, account, wallet } = loadWalletScoring(settings, cryptoCode)
return plugin.getTransactionHash(account, cryptoCode, receivingAddress)
return plugin.getTransactionHash(account, cryptoCode, receivingAddress, wallet)
})
}