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

@ -10,9 +10,14 @@ const SECONDS = 1000
const PUBLISH_TIME = 3 * SECONDS
const AUTHORIZE_TIME = PUBLISH_TIME + 5 * SECONDS
const CONFIRM_TIME = AUTHORIZE_TIME + 10 * SECONDS
const SUPPORTED_COINS = coinUtils.cryptoCurrencies()
let t0
const checkCryptoCode = (cryptoCode) => !_.includes(cryptoCode, SUPPORTED_COINS)
? Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
: Promise.resolve()
function _balance (cryptoCode) {
const cryptoRec = coinUtils.getCryptoCurrency(cryptoCode)
const unitScale = cryptoRec.unitScale
@ -107,7 +112,15 @@ function getStatus (account, tx, requested, settings, operatorId) {
console.log('[%s] DEBUG: Mock wallet has confirmed transaction [%s]', cryptoCode, toAddress.slice(0, 5))
return Promise.resolve({status: 'confirmed'})
return Promise.resolve({ status: 'confirmed' })
}
function getTxHashesByAddress (cryptoCode, address) {
return new Promise((resolve, reject) => {
setTimeout(() => {
return resolve([]) // TODO: should return something other than empty list?
}, 100)
})
}
function checkBlockchainStatus (cryptoCode) {
@ -123,5 +136,6 @@ module.exports = {
newAddress,
getStatus,
newFunding,
checkBlockchainStatus
checkBlockchainStatus,
getTxHashesByAddress
}