Skip to content

Commit

Permalink
Fix error with addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
NahuelNoves committed Apr 10, 2024
1 parent 0530195 commit caf6a83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions types/api/noves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface NovesClassificationData {
type: string | null;
};
message?: string;
deployedContractAddress?: string;
}

export interface Approved {
Expand Down
6 changes: 5 additions & 1 deletion ui/tx/assetFlows/utils/getAddressValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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);
}

0 comments on commit caf6a83

Please sign in to comment.