Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
c5a4eef0
Commit
c5a4eef0
authored
Aug 01, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display ens in tx interpretation
parent
c4ae053b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
TxInterpretation.tsx
ui/shared/tx/interpretation/TxInterpretation.tsx
+16
-4
TxSubHeading.tsx
ui/tx/TxSubHeading.tsx
+9
-1
No files found.
ui/shared/tx/interpretation/TxInterpretation.tsx
View file @
c5a4eef0
...
@@ -23,12 +23,15 @@ import { extractVariables, getStringChunks, fillStringVariables, checkSummary, N
...
@@ -23,12 +23,15 @@ import { extractVariables, getStringChunks, fillStringVariables, checkSummary, N
type
Props
=
{
type
Props
=
{
summary
?:
TxInterpretationSummary
;
summary
?:
TxInterpretationSummary
;
isLoading
?:
boolean
;
isLoading
?:
boolean
;
ensDomainNames
?:
Record
<
string
,
string
>
;
className
?:
string
;
className
?:
string
;
}
}
type
NonStringTxInterpretationVariable
=
Exclude
<
TxInterpretationVariable
,
TxInterpretationVariableString
>
type
NonStringTxInterpretationVariable
=
Exclude
<
TxInterpretationVariable
,
TxInterpretationVariableString
>
const
TxInterpretationElementByType
=
({
variable
}:
{
variable
?:
NonStringTxInterpretationVariable
})
=>
{
const
TxInterpretationElementByType
=
(
{
variable
,
ensDomainNames
}:
{
variable
?:
NonStringTxInterpretationVariable
;
ensDomainNames
?:
Record
<
string
,
string
>
},
)
=>
{
const
onAddressClick
=
React
.
useCallback
(()
=>
{
const
onAddressClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
TX_INTERPRETATION_INTERACTION
,
{
Type
:
'
Address click
'
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
TX_INTERPRETATION_INTERACTION
,
{
Type
:
'
Address click
'
});
},
[]);
},
[]);
...
@@ -48,10 +51,14 @@ const TxInterpretationElementByType = ({ variable }: { variable?: NonStringTxInt
...
@@ -48,10 +51,14 @@ const TxInterpretationElementByType = ({ variable }: { variable?: NonStringTxInt
const
{
type
,
value
}
=
variable
;
const
{
type
,
value
}
=
variable
;
switch
(
type
)
{
switch
(
type
)
{
case
'
address
'
:
{
case
'
address
'
:
{
let
address
=
value
;
if
(
!
address
.
ens_domain_name
&&
ensDomainNames
?.[
address
.
hash
])
{
address
=
{
...
address
,
ens_domain_name
:
ensDomainNames
[
address
.
hash
]
};
}
return
(
return
(
<
chakra
.
span
display=
"inline-block"
verticalAlign=
"top"
_notFirst=
{
{
marginLeft
:
1
}
}
>
<
chakra
.
span
display=
"inline-block"
verticalAlign=
"top"
_notFirst=
{
{
marginLeft
:
1
}
}
>
<
AddressEntity
<
AddressEntity
address=
{
value
}
address=
{
address
}
truncation=
"constant"
truncation=
"constant"
onClick=
{
onAddressClick
}
onClick=
{
onAddressClick
}
whiteSpace=
"initial"
whiteSpace=
"initial"
...
@@ -122,7 +129,7 @@ const TxInterpretationElementByType = ({ variable }: { variable?: NonStringTxInt
...
@@ -122,7 +129,7 @@ const TxInterpretationElementByType = ({ variable }: { variable?: NonStringTxInt
}
}
};
};
const
TxInterpretation
=
({
summary
,
isLoading
,
className
}:
Props
)
=>
{
const
TxInterpretation
=
({
summary
,
isLoading
,
ensDomainNames
,
className
}:
Props
)
=>
{
if
(
!
summary
)
{
if
(
!
summary
)
{
return
null
;
return
null
;
}
}
...
@@ -151,7 +158,12 @@ const TxInterpretation = ({ summary, isLoading, className }: Props) => {
...
@@ -151,7 +158,12 @@ const TxInterpretation = ({ summary, isLoading, className }: Props) => {
{
index
<
variablesNames
.
length
&&
(
{
index
<
variablesNames
.
length
&&
(
variablesNames
[
index
]
===
NATIVE_COIN_SYMBOL_VAR_NAME
?
variablesNames
[
index
]
===
NATIVE_COIN_SYMBOL_VAR_NAME
?
<
chakra
.
span
>
{
currencyUnits
.
ether
+
'
'
}
</
chakra
.
span
>
:
<
chakra
.
span
>
{
currencyUnits
.
ether
+
'
'
}
</
chakra
.
span
>
:
<
TxInterpretationElementByType
variable=
{
variables
[
variablesNames
[
index
]]
as
NonStringTxInterpretationVariable
}
/>
(
<
TxInterpretationElementByType
variable=
{
variables
[
variablesNames
[
index
]]
as
NonStringTxInterpretationVariable
}
ensDomainNames=
{
ensDomainNames
}
/>
)
)
}
)
}
</
chakra
.
span
>
</
chakra
.
span
>
);
);
...
...
ui/tx/TxSubHeading.tsx
View file @
c5a4eef0
...
@@ -59,14 +59,21 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
...
@@ -59,14 +59,21 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
&&
!
novesInterpretationQuery
.
isPlaceholderData
)
||
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
&&
!
novesInterpretationQuery
.
isPlaceholderData
)
||
(
hasInternalInterpretation
&&
!
txInterpretationQuery
.
isPlaceholderData
);
(
hasInternalInterpretation
&&
!
txInterpretationQuery
.
isPlaceholderData
);
const
ensDomainNames
:
Record
<
string
,
string
>
=
{};
[
txQuery
.
data
?.
from
,
txQuery
.
data
?.
to
].
forEach
(
data
=>
{
if
(
data
?.
hash
&&
data
?.
ens_domain_name
)
{
ensDomainNames
[
data
.
hash
]
=
data
.
ens_domain_name
;
}
});
const
content
=
(()
=>
{
const
content
=
(()
=>
{
if
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
)
{
if
(
hasNovesInterpretation
&&
novesInterpretationQuery
.
data
)
{
const
novesSummary
=
createNovesSummaryObject
(
novesInterpretationQuery
.
data
);
const
novesSummary
=
createNovesSummaryObject
(
novesInterpretationQuery
.
data
);
return
(
return
(
<
TxInterpretation
<
TxInterpretation
summary=
{
novesSummary
}
summary=
{
novesSummary
}
isLoading=
{
novesInterpretationQuery
.
isPlaceholderData
}
isLoading=
{
novesInterpretationQuery
.
isPlaceholderData
}
ensDomainNames=
{
ensDomainNames
}
fontSize=
"lg"
fontSize=
"lg"
mr=
{
{
base
:
0
,
lg
:
6
}
}
mr=
{
{
base
:
0
,
lg
:
6
}
}
/>
/>
...
@@ -77,6 +84,7 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
...
@@ -77,6 +84,7 @@ const TxSubHeading = ({ hash, hasTag, txQuery }: Props) => {
<
TxInterpretation
<
TxInterpretation
summary=
{
txInterpretationQuery
.
data
?.
data
.
summaries
[
0
]
}
summary=
{
txInterpretationQuery
.
data
?.
data
.
summaries
[
0
]
}
isLoading=
{
txInterpretationQuery
.
isPlaceholderData
}
isLoading=
{
txInterpretationQuery
.
isPlaceholderData
}
ensDomainNames=
{
ensDomainNames
}
fontSize=
"lg"
fontSize=
"lg"
mr=
{
hasViewAllInterpretationsLink
?
3
:
0
}
mr=
{
hasViewAllInterpretationsLink
?
3
:
0
}
/>
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment