I need to count the number of sent coins from an address to another address.
I found this API https://blockchain.info/rawaddr, is it enough for me, using this method, to simply calculate the "outputs" of the transaction to the address?
JS Code example:
const valueAddreses: IValueAddress = {};
axios.get(`https://blockchain.info/rawaddr/${address}`)
.then((res) => {
if (res.data.txs?.length) {
res.data.txs.forEach((tx) => {
tx.out.forEach((out) => {
if (out.value > 0 && out.addr === findAddress) {
if (!valueAddreses[out.addr]) {
valueAddreses[out.addr] = {value: out.value};
}
valueAddreses[out.addr].value += out.value;
valueAddreses[out.addr].valid = valueAddreses[out.addr].value >= minLimitSat;
}
})
});
res.json(valueAddreses);
}
});