Commit 469f7997 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Invalid case-sensitive comparison in AddressFromTo (#2719)

Fixes #2688
parent 6aa1b99e
......@@ -36,6 +36,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
) ?? 'long';
const Entity = tokenHash && tokenSymbol ? AddressEntityWithTokenFilter : AddressEntity;
const isOutgoing = current ? current.toLowerCase() === from.hash.toLowerCase() : false;
const isIncoming = current ? current.toLowerCase() === to?.hash?.toLowerCase() : false;
if (mode === 'compact') {
return (
......@@ -49,8 +51,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
<Entity
address={ from }
isLoading={ isLoading }
noLink={ current === from.hash }
noCopy={ current === from.hash }
noLink={ isOutgoing }
noCopy={ isOutgoing }
noIcon={ noIcon }
tokenHash={ tokenHash }
tokenSymbol={ tokenSymbol }
......@@ -63,8 +65,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
<Entity
address={ to }
isLoading={ isLoading }
noLink={ current === to.hash }
noCopy={ current === to.hash }
noLink={ isIncoming }
noCopy={ isIncoming }
noIcon={ noIcon }
tokenHash={ tokenHash }
tokenSymbol={ tokenSymbol }
......@@ -78,7 +80,6 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
);
}
const isOutgoing = current === from.hash;
const iconSize = 20;
return (
......@@ -102,8 +103,8 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
<Entity
address={ to }
isLoading={ isLoading }
noLink={ current === to.hash }
noCopy={ current === to.hash }
noLink={ isIncoming }
noCopy={ isIncoming }
noIcon={ noIcon }
tokenHash={ tokenHash }
tokenSymbol={ tokenSymbol }
......
......@@ -7,15 +7,19 @@ export function getTxCourseType(from: string, to: string | undefined, current?:
return 'unspecified';
}
if (to && from === to && from === current) {
const fromLower = from.toLowerCase();
const toLower = to?.toLowerCase();
const currentLower = current.toLowerCase();
if (toLower && fromLower === toLower && fromLower === currentLower) {
return 'self';
}
if (from === current) {
if (fromLower === currentLower) {
return 'out';
}
if (to && to === current) {
if (toLower && toLower === currentLower) {
return 'in';
}
......
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