Commit 3a9c6cb1 authored by Juan Leandro Costa's avatar Juan Leandro Costa Committed by GitHub

Hotfix for Noves integration error with undefined addresses (#1803)

Fix error with addresses
Co-authored-by: default avatarNahuelNoves <Nahuel@noves.fi>
parent dd93c2bc
......@@ -20,6 +20,7 @@ export interface NovesClassificationData {
type: string | null;
};
message?: string;
deployedContractAddress?: string;
}
export interface Approved {
......
......@@ -57,6 +57,10 @@ function extractAddresses(data: NovesResponseData) {
addressesSet.add({ hash: data.classificationData.approved.spender });
}
if (data.classificationData.deployedContractAddress) {
addressesSet.add({ hash: data.classificationData.deployedContractAddress });
}
if (data.txTypeVersion === 2) {
data.classificationData.sent.forEach((transaction) => {
addressesSet.add({ hash: transaction.from.address, name: transaction.from.name });
......@@ -72,5 +76,5 @@ function extractAddresses(data: NovesResponseData) {
const addresses = Array.from(addressesSet) as Array<{hash: string; name?: string}>; // Convert Set to an array
// Remove empty and null values
return addresses.filter(address => address.hash !== null && address.hash !== '');
return addresses.filter(address => address.hash !== null && address.hash !== '' && address.hash !== undefined);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment