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
346a81f1
Commit
346a81f1
authored
Jun 20, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix state changes
parent
f83d0670
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
9 deletions
+46
-9
state.ts
mocks/txs/state.ts
+32
-0
TxState.pw.tsx_default_base-view-mobile-1.png
...reenshots__/TxState.pw.tsx_default_base-view-mobile-1.png
+0
-0
TxState.pw.tsx_mobile_base-view-mobile-1.png
...creenshots__/TxState.pw.tsx_mobile_base-view-mobile-1.png
+0
-0
utils.tsx
ui/tx/state/utils.tsx
+14
-9
No files found.
mocks/txs/state.ts
View file @
346a81f1
...
@@ -143,6 +143,37 @@ export const sendCoin: TxStateChange = {
...
@@ -143,6 +143,37 @@ export const sendCoin: TxStateChange = {
type
:
'
coin
'
,
type
:
'
coin
'
,
};
};
export
const
sendERC20Token
=
{
address
:
{
hash
:
'
0x7f6479df95Aa3036a3BE02DB6300ea201ABd9981
'
,
implementation_name
:
null
,
is_contract
:
false
,
is_verified
:
false
,
name
:
null
,
private_tags
:
[],
public_tags
:
[],
watchlist_names
:
[],
},
balance_after
:
'
6814903154
'
,
balance_before
:
'
9814903154
'
,
change
:
'
-3000000000
'
,
is_miner
:
false
,
token
:
{
address
:
'
0xdAC17F958D2ee523a2206206994597C13D831ec7
'
,
circulating_market_cap
:
'
82978861367.28714
'
,
decimals
:
'
6
'
,
exchange_rate
:
'
0.992839
'
,
holders
:
null
,
icon_url
:
'
https://gateway.tkn.xyz/ipfs/bafybeihrrubjya5nnwgqdm6mfqisxfnv76tl3yd452lkmgomn5n64gzbxu/
'
,
name
:
'
Tether USD
'
,
symbol
:
'
USDT
'
,
total_supply
:
'
39030615894320966
'
,
type
:
'
ERC-20
'
,
token_id
:
null
,
},
type
:
'
token
'
,
};
export
const
baseResponse
=
{
export
const
baseResponse
=
{
items
:
[
items
:
[
mintToken
,
mintToken
,
...
@@ -150,6 +181,7 @@ export const baseResponse = {
...
@@ -150,6 +181,7 @@ export const baseResponse = {
sendCoin
,
sendCoin
,
receiveCoin
,
receiveCoin
,
transfer1155Token
,
transfer1155Token
,
sendERC20Token
,
],
],
next_page_params
:
{
next_page_params
:
{
items_count
:
50
,
items_count
:
50
,
...
...
ui/tx/__screenshots__/TxState.pw.tsx_default_base-view-mobile-1.png
View replaced file @
f83d0670
View file @
346a81f1
46.5 KB
|
W:
|
H:
52.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/tx/__screenshots__/TxState.pw.tsx_mobile_base-view-mobile-1.png
View replaced file @
f83d0670
View file @
346a81f1
64.4 KB
|
W:
|
H:
75.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/tx/state/utils.tsx
View file @
346a81f1
...
@@ -77,21 +77,26 @@ export function getStateElements(data: TxStateChange, isLoading?: boolean) {
...
@@ -77,21 +77,26 @@ export function getStateElements(data: TxStateChange, isLoading?: boolean) {
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
/>
/>
);
);
const
before
=
Number
(
data
.
balance_before
);
const
before
Bn
=
BigNumber
(
data
.
balance_before
||
'
0
'
).
div
(
BigNumber
(
10
**
(
Number
(
data
.
token
.
decimals
)))
);
const
after
=
Number
(
data
.
balance_after
);
const
after
Bn
=
BigNumber
(
data
.
balance_after
||
'
0
'
).
div
(
BigNumber
(
10
**
(
Number
(
data
.
token
.
decimals
)))
);
const
change
=
(()
=>
{
const
change
=
(()
=>
{
const
difference
=
typeof
data
.
change
===
'
string
'
?
Number
(
data
.
change
)
:
after
-
before
;
let
differenceBn
;
if
(
typeof
data
.
change
===
'
string
'
)
{
differenceBn
=
BigNumber
(
data
.
change
||
'
0
'
).
div
(
BigNumber
(
10
**
(
Number
(
data
.
token
.
decimals
))));
}
else
{
differenceBn
=
afterBn
.
minus
(
beforeBn
);
}
if
(
!
difference
)
{
if
(
!
difference
Bn
||
differenceBn
.
isEqualTo
(
0
)
)
{
return
null
;
return
null
;
}
}
const
changeColor
=
difference
>=
0
?
'
green.500
'
:
'
red.500
'
;
const
changeColor
=
difference
Bn
.
isGreaterThanOrEqualTo
(
0
)
?
'
green.500
'
:
'
red.500
'
;
const
changeSign
=
difference
>=
0
?
'
+
'
:
'
-
'
;
const
changeSign
=
difference
Bn
.
isGreaterThanOrEqualTo
(
0
)
?
'
+
'
:
'
-
'
;
return
(
return
(
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"inline-block"
color=
{
changeColor
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"inline-block"
color=
{
changeColor
}
>
<
span
>
{
changeSign
}{
nbsp
}{
Math
.
abs
(
difference
).
toLocaleString
()
}
</
span
>
<
span
>
{
changeSign
}{
nbsp
}{
differenceBn
.
abs
().
toFormat
()
}
</
span
>
</
Skeleton
>
</
Skeleton
>
);
);
})();
})();
...
@@ -119,14 +124,14 @@ export function getStateElements(data: TxStateChange, isLoading?: boolean) {
...
@@ -119,14 +124,14 @@ export function getStateElements(data: TxStateChange, isLoading?: boolean) {
return
{
return
{
before
:
data
.
balance_before
?
(
before
:
data
.
balance_before
?
(
<
Flex
whiteSpace=
"pre-wrap"
justifyContent=
{
{
base
:
'
flex-start
'
,
lg
:
'
flex-end
'
}
}
>
<
Flex
whiteSpace=
"pre-wrap"
justifyContent=
{
{
base
:
'
flex-start
'
,
lg
:
'
flex-end
'
}
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
>
{
before
.
toLocaleString
()
}
</
Skeleton
>
<
Skeleton
isLoaded=
{
!
isLoading
}
>
{
before
Bn
.
toFormat
()
}
</
Skeleton
>
<
span
>
{
space
}
</
span
>
<
span
>
{
space
}
</
span
>
{
tokenLink
}
{
tokenLink
}
</
Flex
>
</
Flex
>
)
:
null
,
)
:
null
,
after
:
data
.
balance_after
?
(
after
:
data
.
balance_after
?
(
<
Flex
whiteSpace=
"pre-wrap"
justifyContent=
{
{
base
:
'
flex-start
'
,
lg
:
'
flex-end
'
}
}
>
<
Flex
whiteSpace=
"pre-wrap"
justifyContent=
{
{
base
:
'
flex-start
'
,
lg
:
'
flex-end
'
}
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
>
{
after
.
toLocaleString
()
}
</
Skeleton
>
<
Skeleton
isLoaded=
{
!
isLoading
}
>
{
after
Bn
.
toFormat
()
}
</
Skeleton
>
<
span
>
{
space
}
</
span
>
<
span
>
{
space
}
</
span
>
{
tokenLink
}
{
tokenLink
}
</
Flex
>
</
Flex
>
...
...
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