Revert "fix: remove coins not supported by ciphertrace"

This reverts commit e798be94ae.
This commit is contained in:
José Oliveira 2022-07-20 11:21:28 +01:00
parent e798be94ae
commit 71212d8cd1
3 changed files with 12 additions and 3 deletions

View file

@ -126,7 +126,10 @@ function checkBlockchainStatus (cryptoCode) {
}
function getTxHashesByAddress (cryptoCode, address) {
throw new Error(`Transactions hash retrieval is not implemented for this coin!`)
checkCryptoCode(cryptoCode)
.then(() => fetch('listreceivedbyaddress', [0, true, true, true, address]))
.then(txsByAddress => Promise.all(_.forEach(id => fetch('getrawtransaction', [id]), _.head(txsByAddress).txids)))
.then(_.map(({ hash }) => hash))
}
module.exports = {

View file

@ -236,7 +236,11 @@ function checkBlockchainStatus (cryptoCode) {
}
function getTxHashesByAddress (cryptoCode, address) {
throw new Error(`Transactions hash retrieval is not implemented for this coin!`)
checkCryptoCode(cryptoCode)
.then(() => refreshWallet())
.then(() => fetch('get_address_index', { address: address }))
.then(addressRes => fetch('get_transfers', { in: true, pool: true, pending: true, account_index: addressRes.index.major, address_indices: [addressRes.index.minor] }))
.then(_.map(({ txid }) => txid))
}
module.exports = {

View file

@ -152,7 +152,9 @@ function checkBlockchainStatus (cryptoCode) {
}
function getTxHashesByAddress (cryptoCode, address) {
throw new Error(`Transactions hash retrieval is not implemented for this coin!`)
checkCryptoCode(cryptoCode)
.then(() => fetch('getaddresstxids', [address]))
.then(_.mapKeys(() => 'txid'))
}
module.exports = {