Fix display Sourcify verification status for created contracts on block tx results
This commit is contained in:
parent
9fb6e1877d
commit
0439be7ac9
|
@ -114,6 +114,9 @@ const AddressTransactionResults: React.FC<AddressTransactionResultsProps> = ({
|
||||||
if (t.to) {
|
if (t.to) {
|
||||||
_addresses.push(t.to);
|
_addresses.push(t.to);
|
||||||
}
|
}
|
||||||
|
if (t.createdContractAddress) {
|
||||||
|
_addresses.push(t.createdContractAddress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _addresses;
|
return _addresses;
|
||||||
|
|
|
@ -40,7 +40,16 @@ const BlockTransactionResults: React.FC<BlockTransactionResultsProps> = ({
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return page.map((t) => t.to).filter((to): to is string => to !== null);
|
const _addresses: ChecksummedAddress[] = [];
|
||||||
|
for (const t of page) {
|
||||||
|
if (t.to) {
|
||||||
|
_addresses.push(t.to);
|
||||||
|
}
|
||||||
|
if (t.createdContractAddress) {
|
||||||
|
_addresses.push(t.createdContractAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _addresses;
|
||||||
}, [page]);
|
}, [page]);
|
||||||
const metadatas = useContractsMetadata(addresses, provider);
|
const metadatas = useContractsMetadata(addresses, provider);
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,13 @@ export const useBlockTransactions = (
|
||||||
const _receipts = result.receipts;
|
const _receipts = result.receipts;
|
||||||
|
|
||||||
const rawTxs = _block.transactions
|
const rawTxs = _block.transactions
|
||||||
.map(
|
.map((t, i): ProcessedTransaction => {
|
||||||
(t, i): ProcessedTransaction => ({
|
const _rawReceipt = _receipts[i];
|
||||||
|
// Empty logs on purpose because of ethers formatter requires it
|
||||||
|
_rawReceipt.logs = [];
|
||||||
|
const _receipt = provider.formatter.receipt(_rawReceipt);
|
||||||
|
|
||||||
|
return {
|
||||||
blockNumber: blockNumber,
|
blockNumber: blockNumber,
|
||||||
timestamp: _block.timestamp,
|
timestamp: _block.timestamp,
|
||||||
miner: _block.miner,
|
miner: _block.miner,
|
||||||
|
@ -104,24 +109,24 @@ export const useBlockTransactions = (
|
||||||
hash: t.hash,
|
hash: t.hash,
|
||||||
from: t.from,
|
from: t.from,
|
||||||
to: t.to ?? null,
|
to: t.to ?? null,
|
||||||
createdContractAddress: _receipts[i].contractAddress,
|
createdContractAddress: _receipt.contractAddress,
|
||||||
value: t.value,
|
value: t.value,
|
||||||
fee:
|
fee:
|
||||||
t.type !== 2
|
t.type !== 2
|
||||||
? provider.formatter
|
? provider.formatter
|
||||||
.bigNumber(_receipts[i].gasUsed)
|
.bigNumber(_receipt.gasUsed)
|
||||||
.mul(t.gasPrice!)
|
.mul(t.gasPrice!)
|
||||||
: provider.formatter
|
: provider.formatter
|
||||||
.bigNumber(_receipts[i].gasUsed)
|
.bigNumber(_receipt.gasUsed)
|
||||||
.mul(t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!)),
|
.mul(t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!)),
|
||||||
gasPrice:
|
gasPrice:
|
||||||
t.type !== 2
|
t.type !== 2
|
||||||
? t.gasPrice!
|
? t.gasPrice!
|
||||||
: t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!),
|
: t.maxPriorityFeePerGas!.add(_block.baseFeePerGas!),
|
||||||
data: t.data,
|
data: t.data,
|
||||||
status: provider.formatter.number(_receipts[i].status),
|
status: provider.formatter.number(_receipt.status),
|
||||||
|
};
|
||||||
})
|
})
|
||||||
)
|
|
||||||
.reverse();
|
.reverse();
|
||||||
setTxs(rawTxs);
|
setTxs(rawTxs);
|
||||||
setTotalTxs(result.fullblock.transactionCount);
|
setTotalTxs(result.fullblock.transactionCount);
|
||||||
|
|
Loading…
Reference in New Issue