Simplify syntax
This commit is contained in:
parent
e3a21bd4b2
commit
66d6ccae10
@ -255,22 +255,14 @@ export const useTokenTransfers = (
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const _transfers: TokenTransfer[] = [];
|
return txData.confirmedData.logs
|
||||||
for (const l of txData.confirmedData.logs) {
|
.filter((l) => l.topics.length === 3 && l.topics[0] === TRANSFER_TOPIC)
|
||||||
if (l.topics.length !== 3) {
|
.map((l) => ({
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (l.topics[0] !== TRANSFER_TOPIC) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_transfers.push({
|
|
||||||
token: l.address,
|
token: l.address,
|
||||||
from: getAddress(hexDataSlice(arrayify(l.topics[1]), 12)),
|
from: getAddress(hexDataSlice(arrayify(l.topics[1]), 12)),
|
||||||
to: getAddress(hexDataSlice(arrayify(l.topics[2]), 12)),
|
to: getAddress(hexDataSlice(arrayify(l.topics[2]), 12)),
|
||||||
value: BigNumber.from(l.data),
|
value: BigNumber.from(l.data),
|
||||||
});
|
}));
|
||||||
}
|
|
||||||
return _transfers;
|
|
||||||
}, [txData]);
|
}, [txData]);
|
||||||
|
|
||||||
return transfers;
|
return transfers;
|
||||||
|
Loading…
Reference in New Issue
Block a user