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
11a56827
Commit
11a56827
authored
Apr 10, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove array cheching in tx details token transfers
parent
a45a5752
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
37 deletions
+34
-37
token.ts
types/api/token.ts
+0
-2
tokenTransfer.ts
types/api/tokenTransfer.ts
+5
-5
TxDetailsTokenTransfer.tsx
ui/tx/details/TxDetailsTokenTransfer.tsx
+28
-29
TxDetailsTokenTransfers.tsx
ui/tx/details/TxDetailsTokenTransfers.tsx
+1
-1
No files found.
types/api/token.ts
View file @
11a56827
...
...
@@ -18,8 +18,6 @@ export interface TokenCounters {
transfers_count
:
string
;
}
export
type
TokenInfoGeneric
<
Type
extends
TokenType
>
=
Omit
<
TokenInfo
,
'
type
'
>
&
{
type
:
Type
};
export
interface
TokenHolders
{
items
:
Array
<
TokenHolder
>
;
next_page_params
:
TokenHoldersPagination
;
...
...
types/api/tokenTransfer.ts
View file @
11a56827
import
type
{
AddressParam
}
from
'
./addressParams
'
;
import
type
{
TokenInfo
Generic
,
TokenType
}
from
'
./token
'
;
import
type
{
TokenInfo
,
TokenType
}
from
'
./token
'
;
export
type
Erc20TotalPayload
=
{
decimals
:
string
|
null
;
...
...
@@ -18,20 +18,20 @@ export type Erc1155TotalPayload = {
export
type
TokenTransfer
=
(
{
token
:
TokenInfo
Generic
<
'
ERC-20
'
>
;
token
:
TokenInfo
<
'
ERC-20
'
>
;
total
:
Erc20TotalPayload
;
}
|
{
token
:
TokenInfo
Generic
<
'
ERC-721
'
>
;
token
:
TokenInfo
<
'
ERC-721
'
>
;
total
:
Erc721TotalPayload
;
}
|
{
token
:
TokenInfo
Generic
<
'
ERC-1155
'
>
;
token
:
TokenInfo
<
'
ERC-1155
'
>
;
total
:
Erc1155TotalPayload
;
}
)
&
TokenTransferBase
export
type
TokenTotal
=
Erc20TotalPayload
|
Erc721TotalPayload
|
Erc1155TotalPayload
|
Array
<
Erc1155TotalPayload
>
;
export
type
TokenTotal
=
Erc20TotalPayload
|
Erc721TotalPayload
|
Erc1155TotalPayload
;
interface
TokenTransferBase
{
type
:
'
token_transfer
'
|
'
token_burning
'
|
'
token_spawning
'
|
'
token_minting
'
;
...
...
ui/tx/details/TxDetailsTokenTransfer.tsx
View file @
11a56827
...
...
@@ -11,25 +11,25 @@ import CurrencyValue from 'ui/shared/CurrencyValue';
import
TokenSnippet
from
'
ui/shared/TokenSnippet/TokenSnippet
'
;
import
NftTokenTransferSnippet
from
'
ui/tx/NftTokenTransferSnippet
'
;
type
Props
=
TTokenTransfer
;
interface
Props
{
data
:
TTokenTransfer
;
}
const
TxDetailsTokenTransfer
=
({
token
,
total
,
to
,
from
}:
Props
)
=>
{
const
isColumnLayout
=
token
.
type
===
'
ERC-1155
'
&&
Array
.
isArray
(
total
);
const
TxDetailsTokenTransfer
=
({
data
}:
Props
)
=>
{
const
content
=
(()
=>
{
switch
(
token
.
type
)
{
switch
(
data
.
token
.
type
)
{
case
'
ERC-20
'
:
{
const
payload
=
total
as
Erc20TotalPayload
;
const
total
=
data
.
total
as
Erc20TotalPayload
;
return
(
<
Flex
flexWrap=
"wrap"
columnGap=
{
3
}
rowGap=
{
2
}
>
<
Text
fontWeight=
{
500
}
as=
"span"
>
For:
{
space
}
<
CurrencyValue
value=
{
payload
.
value
}
exchangeRate=
{
token
.
exchange_rate
}
fontWeight=
{
600
}
decimals=
{
payload
.
decimals
}
/>
<
CurrencyValue
value=
{
total
.
value
}
exchangeRate=
{
data
.
token
.
exchange_rate
}
fontWeight=
{
600
}
decimals=
{
total
.
decimals
}
/>
</
Text
>
<
TokenSnippet
symbol=
{
trimTokenSymbol
(
token
.
symbol
)
}
hash=
{
token
.
address
}
name=
{
token
.
name
}
symbol=
{
trimTokenSymbol
(
data
.
token
.
symbol
)
}
hash=
{
data
.
token
.
address
}
name=
{
data
.
token
.
name
}
w=
"auto"
flexGrow=
"1"
columnGap=
{
1
}
...
...
@@ -40,47 +40,46 @@ const TxDetailsTokenTransfer = ({ token, total, to, from }: Props) => {
}
case
'
ERC-721
'
:
{
const
payload
=
total
as
Erc721TotalPayload
;
const
total
=
data
.
total
as
Erc721TotalPayload
;
return
(
<
NftTokenTransferSnippet
name=
{
token
.
name
}
tokenId=
{
payload
.
token_id
}
name=
{
data
.
token
.
name
}
tokenId=
{
total
.
token_id
}
value=
"1"
hash=
{
token
.
address
}
symbol=
{
trimTokenSymbol
(
token
.
symbol
)
}
hash=
{
data
.
token
.
address
}
symbol=
{
trimTokenSymbol
(
data
.
token
.
symbol
)
}
/>
);
}
case
'
ERC-1155
'
:
{
const
payload
=
total
as
Erc1155TotalPayload
|
Array
<
Erc1155TotalPayload
>
;
const
items
=
Array
.
isArray
(
payload
)
?
payload
:
[
payload
];
return
items
.
map
((
item
)
=>
(
const
total
=
data
.
total
as
Erc1155TotalPayload
;
return
(
<
NftTokenTransferSnippet
name=
{
token
.
name
}
key=
{
item
.
token_id
}
tokenId=
{
item
.
token_id
}
value=
{
item
.
value
}
hash=
{
token
.
address
}
symbol=
{
trimTokenSymbol
(
token
.
symbol
)
}
name=
{
data
.
token
.
name
}
key=
{
total
.
token_id
}
tokenId=
{
total
.
token_id
}
value=
{
total
.
value
}
hash=
{
data
.
token
.
address
}
symbol=
{
trimTokenSymbol
(
data
.
token
.
symbol
)
}
/>
)
)
;
);
}
}
})();
return
(
<
Flex
alignItems=
{
isColumnLayout
?
'
flex-start
'
:
'
center
'
}
alignItems=
"center"
flexWrap=
"wrap"
columnGap=
{
3
}
rowGap=
{
3
}
flexDir=
{
isColumnLayout
?
'
column
'
:
'
row
'
}
flexDir=
"row"
>
<
Flex
alignItems=
"center"
>
<
AddressLink
type=
"address"
fontWeight=
"500"
hash=
{
from
.
hash
}
truncation=
"constant"
/>
<
AddressLink
type=
"address"
fontWeight=
"500"
hash=
{
data
.
from
.
hash
}
truncation=
"constant"
/>
<
Icon
as=
{
rightArrowIcon
}
boxSize=
{
6
}
mx=
{
2
}
color=
"gray.500"
/>
<
AddressLink
type=
"address"
fontWeight=
"500"
hash=
{
to
.
hash
}
truncation=
"constant"
/>
<
AddressLink
type=
"address"
fontWeight=
"500"
hash=
{
data
.
to
.
hash
}
truncation=
"constant"
/>
</
Flex
>
<
Flex
flexDir=
"column"
rowGap=
{
5
}
>
{
content
}
...
...
ui/tx/details/TxDetailsTokenTransfers.tsx
View file @
11a56827
...
...
@@ -52,7 +52,7 @@ const TxDetailsTokenTransfers = ({ data, txHash }: Props) => {
rowGap=
{
5
}
w=
"100%"
>
{
items
.
slice
(
0
,
VISIBLE_ITEMS_NUM
).
map
((
item
,
index
)
=>
<
TxDetailsTokenTransfer
key=
{
index
}
{
...
item
}
/>)
}
{
items
.
slice
(
0
,
VISIBLE_ITEMS_NUM
).
map
((
item
,
index
)
=>
<
TxDetailsTokenTransfer
key=
{
index
}
data=
{
item
}
/>)
}
</
Flex
>
</
DetailsInfoItem
>
);
...
...
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