Skip to content

Commit

Permalink
Hotfix for Noves integration error with undefined addresses (#1803)
Browse files Browse the repository at this point in the history
Fix error with addresses

Co-authored-by: NahuelNoves <[email protected]>
  • Loading branch information
juanlenoves and NahuelNoves authored Apr 11, 2024
1 parent dd93c2b commit 3a9c6cb
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 3a9c6cb

Please sign in to comment.