We can retrieve transaction details using operation hash in Taquito.
Hope the below code will be useful.
const rpc = require('@taquito/rpc').RpcClient;
const client = new rpc("TEZOS NODE RPC URL", "CHAIN ID of the TEZOS NODE");
const getTransaction = async function(opHash){
const presentBlock = await client.getBlock();
const hashValue = presentBlock.hash;
for(let i = 1; i <= presentBlock.header.level; i++){
let block = await client.getBlock({
block : hashValue + '~' + i
});
block.operations.forEach(opArray => {
if(opArray.length){
opArray.forEach(opObj => {
if(opObj.hash == opHash){
console.log(opObj); break;
}
});
}
});
}
}
Basically, I am iterating all blocks synced by my tezos node. If you feel there are numerate blocks, then you can give start block and end block as limits and improve the code. Thanks. @claude-barde correct me if I am wrong.