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
86d574cd
Commit
86d574cd
authored
Dec 21, 2022
by
POA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lint:tsc errors
parent
cb203e6e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
9 deletions
+21
-9
txAction.ts
types/api/txAction.ts
+2
-3
TxDetailsAction.tsx
ui/tx/details/TxDetailsAction.tsx
+18
-5
TxDetailsActions.tsx
ui/tx/details/TxDetailsActions.tsx
+1
-1
No files found.
types/api/txAction.ts
View file @
86d574cd
export
type
TxAction
=
{
export
type
TxAction
=
{
protocol
:
string
;
protocol
:
'
uniswap_v3
'
;
type
:
string
;
type
:
'
mint
'
|
'
burn
'
|
'
collect
'
|
'
swap
'
|
'
mint_nft
'
;
data
:
{
data
:
{
name
:
string
;
name
:
string
;
symbol
:
string
;
symbol
:
string
;
...
@@ -14,5 +14,4 @@ export type TxAction = {
...
@@ -14,5 +14,4 @@ export type TxAction = {
symbol1
:
string
;
symbol1
:
string
;
address1
:
string
;
address1
:
string
;
};
};
isLast
:
boolean
;
}
}
ui/tx/details/TxDetailsAction.tsx
View file @
86d574cd
...
@@ -12,9 +12,12 @@ import TokenSnippet from 'ui/shared/TokenSnippet/TokenSnippet';
...
@@ -12,9 +12,12 @@ import TokenSnippet from 'ui/shared/TokenSnippet/TokenSnippet';
const
uniswapIconUrl
=
'
https://raw.githubusercontent.com/trustwallet/assets/master/dapps/app.uniswap.org.png
'
;
const
uniswapIconUrl
=
'
https://raw.githubusercontent.com/trustwallet/assets/master/dapps/app.uniswap.org.png
'
;
type
Props
=
TTxAction
;
interface
Props
{
action
:
TTxAction
;
isLast
:
boolean
;
}
function
a
ctionName
(
actionType
:
string
)
{
function
uniswapA
ctionName
(
actionType
:
string
)
{
switch
(
actionType
)
{
switch
(
actionType
)
{
case
'
mint
'
:
return
[
'
Add
'
,
'
Liquidity To
'
];
case
'
mint
'
:
return
[
'
Add
'
,
'
Liquidity To
'
];
case
'
burn
'
:
return
[
'
Remove
'
,
'
Liquidity From
'
];
case
'
burn
'
:
return
[
'
Remove
'
,
'
Liquidity From
'
];
...
@@ -24,7 +27,13 @@ function actionName(actionType: string) {
...
@@ -24,7 +27,13 @@ function actionName(actionType: string) {
}
}
}
}
const
TxDetailsAction
=
({
protocol
,
type
,
data
,
isLast
}:
Props
)
=>
{
function
unknownAction
()
{
return
(<
span
>
Unrecognized action
</
span
>);
}
const
TxDetailsAction
=
({
action
,
isLast
}:
Props
)
=>
{
const
{
protocol
,
type
,
data
}
=
action
;
if
(
protocol
===
'
uniswap_v3
'
)
{
if
(
protocol
===
'
uniswap_v3
'
)
{
if
([
'
mint
'
,
'
burn
'
,
'
collect
'
,
'
swap
'
].
includes
(
type
))
{
if
([
'
mint
'
,
'
burn
'
,
'
collect
'
,
'
swap
'
].
includes
(
type
))
{
const
amount0
=
BigNumber
(
data
.
amount0
).
toFormat
();
const
amount0
=
BigNumber
(
data
.
amount0
).
toFormat
();
...
@@ -33,7 +42,7 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
...
@@ -33,7 +42,7 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
return
(
return
(
<
Flex
flexWrap=
"wrap"
columnGap=
{
1
}
rowGap=
{
2
}
className=
{
isLast
?
'
lastItem
'
:
''
}
marginBottom=
{
isLast
?
5
:
0
}
>
<
Flex
flexWrap=
"wrap"
columnGap=
{
1
}
rowGap=
{
2
}
className=
{
isLast
?
'
lastItem
'
:
''
}
marginBottom=
{
isLast
?
5
:
0
}
>
<
Text
color=
"gray.500"
as=
"span"
>
<
Text
color=
"gray.500"
as=
"span"
>
{
a
ctionName
(
type
)[
0
]
}
{
uniswapA
ctionName
(
type
)[
0
]
}
</
Text
>
</
Text
>
<
Flex
columnGap=
{
1
}
>
<
Flex
columnGap=
{
1
}
>
...
@@ -51,7 +60,7 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
...
@@ -51,7 +60,7 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
</
Flex
>
</
Flex
>
<
Text
color=
"gray.500"
as=
"span"
>
<
Text
color=
"gray.500"
as=
"span"
>
{
a
ctionName
(
type
)[
1
]
}
{
uniswapA
ctionName
(
type
)[
1
]
}
</
Text
>
</
Text
>
<
Flex
columnGap=
{
1
}
>
<
Flex
columnGap=
{
1
}
>
...
@@ -100,7 +109,11 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
...
@@ -100,7 +109,11 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
</
Flex
>
</
Flex
>
</
Flex
>
</
Flex
>
);
);
}
else
{
return
unknownAction
();
}
}
}
else
{
return
unknownAction
();
}
}
};
};
...
...
ui/tx/details/TxDetailsActions.tsx
View file @
86d574cd
...
@@ -54,7 +54,7 @@ const TxDetailsActions = ({ actions }: Props) => {
...
@@ -54,7 +54,7 @@ const TxDetailsActions = ({ actions }: Props) => {
w=
"100%"
w=
"100%"
fontWeight=
{
500
}
fontWeight=
{
500
}
>
>
{
actions
.
map
((
action
,
index
:
number
)
=>
<
TxDetailsAction
key=
{
index
}
{
...
action
}
isLast=
{
index
===
actions
.
length
-
1
}
/>)
}
{
actions
.
map
((
action
,
index
:
number
)
=>
<
TxDetailsAction
key=
{
index
}
action=
{
action
}
isLast=
{
index
===
actions
.
length
-
1
}
/>)
}
</
Flex
>
</
Flex
>
</
Box
>
</
Box
>
{
/* eslint-disable-next-line react/jsx-no-bind */
}
{
/* eslint-disable-next-line react/jsx-no-bind */
}
...
...
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