Calculate XUDT amount separately in AssetSummarizer instead of mixing the data of XUDT/DOB cells
The XUDT/DOB summary issue
Previously, when calculating AssetSummary, DOBs were treated as regular XUDT cells. This led to inaccuracies in the calculation of the total containing amount of an XUDT asset because the data for DOBs was treated as XUDT amounts and added to the summary result, while in reality, the data for DOBs differs from that of XUDT cells.
For example, the following asset summary includes a very large amount that looks unusual at first glance:
This PR ensures the accuracy of the XUDT total containing amount calculation by adding a check statement while iterating through each cell related to a UTXO. However, the summary calculation for those non-XUDT assets has not been implemented:
for (const cell of cells) {
const isXudt = !!cell.cellOutput.type && isUDTTypeSupported(cell.cellOutput.type, this.isMainnet);
if (isXudt) {
// If the cell type is a supported xUDT type, record its asset information
...
} else {
// TODO: If the cell type is empty or not xUDT, how should we handle/record its info?
}
}
Changes
The XUDT/DOB summary issue
Previously, when calculating
AssetSummary
, DOBs were treated as regular XUDT cells. This led to inaccuracies in the calculation of the total containing amount of an XUDT asset because the data for DOBs was treated as XUDT amounts and added to the summary result, while in reality, the data for DOBs differs from that of XUDT cells.For example, the following asset summary includes a very large amount that looks unusual at first glance:
This PR ensures the accuracy of the XUDT total containing amount calculation by adding a check statement while iterating through each cell related to a UTXO. However, the summary calculation for those non-XUDT assets has not been implemented: